我目前正在Elixir寫一個小測試跑步者。我想使用模式匹配來評估文件是否處於規格格式(以「_spec.exs」結尾)。上有許多教程如何在一個字符串的開頭模式匹配,但是,不知怎的,不會對字符串的結尾工作:字符串/二進制參數結尾的模式匹配
== Compilation error on file lib/monitor.ex ==
** (CompileError) lib/monitor.ex:13: a binary field without size is only allowed at the end of a binary pattern
(stdlib) lists.erl:1337: :lists.foreach/2
(stdlib) erl_eval.erl:669: :erl_eval.do_apply/6
:
defp filter_spec(file <> "_spec.exs") do
run_spec(file)
end
defp run_spec(file) do
...
end
這總是在編譯錯誤結束有沒有解決方案?
是的,你是對的。這不可能。 –