我完全可以寫一個「正常」測試,爲此捕獲IO。 只想知道是否可以使用Doctest。 一個例子是: defmodule CLI do
@doc """
Politely says Hello.
## Examples
iex> CLI.main([])
"Hello dear person." # this would be the exp
我初學花好月圓,我試圖做一個查詢,有: def posts_liked(%{id: id}, _info) do
query = from u in Like, where: u.user_id == ^id
{:ok, Repo.all(query)}
end
但是,說變量u不存在。但是,in oficial doc也有相同的代碼和其他手冊。如何解決它? 我Like方案