Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception on failing test #120

Open
houshuang opened this issue May 11, 2015 · 1 comment
Open

Exception on failing test #120

houshuang opened this issue May 11, 2015 · 1 comment

Comments

@houshuang
Copy link
Contributor

Amrita works great on my passing tests, but on my first failing test, it creates an exception, and does not show me LHS and RHS, as ExUnit does.

Here is my test

fact "string and int", do: req("<param><value><string>hi</string></value></param><param><value><int>2</int></value></param>") |> {:ok, ["hi", 2]}

and here is the output

1) test string and int (XmlrpcTest)
 test/xmlrpc_test.exs:21
 ** (Amrita.FactError) Expected:
      {:ok, [2, "hi"]} |> test string and int
 stacktrace:
   lib/amrita/message.ex:10: Amrita.Message.fail/3
   test/xmlrpc_test.exs:21
@houshuang
Copy link
Contributor Author

I monkey-patched fact-error.ex like this

-      "     #{Amrita.FactError.actual_result(exception)} |> #{Amrita.FactError.full_checker(exception)}" 
+      "     #{Amrita.FactError.actual_result(exception)} |> #{exception.expected}"

and now it gives the desired output

1) test string and int (XmlrpcTest)
 test/xmlrpc_test.exs:22
 ** (Amrita.FactError) Expected:
      {:ok, [2, "hi"]} |> {:ok, ["hi", 2]}
 stacktrace:
   lib/amrita/message.ex:10: Amrita.Message.fail/3
   test/xmlrpc_test.exs:22

I don't really need the whole stack-trace below, but otherwise it's working great. Love the compact format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant