josephwilk/amrita

nicer error messaged on bad mock form

Opened this issue · 0 comments

Code (Notice I missed the comma between name and mock... pesky Clojure)

fact "less_than_or_equal? with a dev elixir version" [System.version |> "0.10.2-dev"] do
end

Error

** (Protocol.UndefinedError) protocol Binary.Chars not implemented for {{:., [line: 15], [Kernel, :access]}, [line: 15], ["less_than_or_equal? with a dev elixir version", {:|>, [line: 15], [{{:., [line: 15], [{:__aliases__, [line: 15], [:System]}, :version]}, [line: 15], []}, "0.10.2-dev"]}]}
    /Users/josephwilk/Workspace/josephwilk/elixir/amrita/lib/amrita.ex:106: Amrita.Facts.fact_name/1
    /Users/josephwilk/Workspace/josephwilk/elixir/amrita/lib/amrita.ex:145: Amrita.Facts."MACRO-fact"/5
    /Users/josephwilk/Workspace/josephwilk/elixir/amrita/test/unit/amrita/elixir/t_version.exs:15: Amrita.Facts.fact/2

And again I messed up the form (missed out keyword provided), should be a nicer error if possible:

Code

fact "less_than_or_equal? with a dev elixir version", [System.version |> "0.10.2-dev"] do                 |
    Version.less_than_or_equal?([0,10,1]) |> truthy                                                                   |
  end

Error

** (ArgumentError) unsupported expression in pipeline |> operator: "0.10.2-dev"
    /Users/josephwilk/Workspace/josephwilk/elixir/amrita/test/unit/amrita/elixir/t_version.exs:15: Kernel.|>/2