我完全可以写一个“正常”测试,为此捕获IO。 只想知道是否可以使用Doctest。 一个例子是: defmodule CLI do
@doc """
Politely says Hello.
## Examples
iex> CLI.main([])
"Hello dear person." # this would be the exp
我在凤凰应用以下测试: defmodule TattooBackend.Web.API.V1.PasswordControllerTest do
use TattooBackend.Web.ConnCase, async: true
use Bamboo.Test
alias TattooBackend.Web.Endpoint
alias TattooB
我正在测试函数的返回值。哪两个是首选的方式? test "extra verbose, using assert" do
{:error, reason} = MyModule.my_fun
assert reason == :nope
end
test "using pattern matching only" do
{:error, :nope} = MyM