我正在尝试升级我的库的测试。最初的测试基于Amrita。以下代码是测试之一,因为自去年以来Amrita尚未升级,所以我决定将我的测试迁移到使用默认测试框架。我改变了代码:
fact "Test symlink: For non existent src file" do
src = Path.join(fixture_path, "testdir3xx")
try do
@dest |> ! path_exists
symlink(src, @dest)
F.read_link(@dest) |> {:error, :enoent}
@dest |> ! path_exists
after
File.rm_rf @dest
end
end
到此:
defmodule TestSymlinkFornonexistent do
src = Path.join(fixture_path, "testdir3xx")
try do
@dest |> File.exists? |> refute
symlink(src, @dest)
F.read_link(@dest) |> {:error, :enoent}
@dest |> ! path_exists
after
File.rm_rf @dest
end
end
使用MIX_ENV=test mix test --trace
运行时,我得到的错误如下。
** (ArgumentError) cannot pipe F.read_link(@dest) into {:error, :enoent}, can only pipe into local calls foo(), remote calls Foo.bar() or anonymous functions calls foo.()
不要真正理解它应该出现的错误或形式。有人可以帮忙吗?