我完全可以写一个“正常”测试,为此捕获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方案