0
我寫的真棒印記:藥劑:doctesting一個印記
defmodule Sigiltest do
@doc """
An awesome sigil!
### Usage
iex> ~a{I love elixir}
"I love elixir, awesome!"
"""
def sigil_a(content, _flags) do
"#{content}, awesome!"
end
end
下面是測試模塊:
defmodule SigiltestTest do
use ExUnit.Case
doctest Sigiltest
end
當我運行mix test
我得到以下的輸出:
Compiled lib/sigiltest.ex
** (CompileError) (for doctest at) lib/sigiltest.ex:7: undefined function sigil_a/2
(stdlib) lists.erl:1337: :lists.foreach/2
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
有沒有辦法在sigil上運行doctests? 如果是這樣,怎麼樣?