Switching from `AssertionError` to `ExpectationError` gives us a nicer
error message and allows us to easily include the incorrect result as a
description.
Fixes#1276
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
If the asserted statement evaluates to false, show the unevaluated
statement in the assertion error output message for more context about
the failure. Refute also now follows similar semantics.
Fixes#1276
Defining setup/teardown/test explicitly is now deprecated.
They should now be defined via their respective macros:
def setup do
...
end
Now becomes:
setup do
...
end
When defined using the new format, setup callbacks can
return metadata:
setup do
[do_this: :do_that]
end
And now the test macro can access this metadata:
test "check metadata", data do
assert data[:do_this] == :do_that
end
Previously, we were generating atom names based on
the file or the module name. This commit replaces
it by a pool of atom names. After a module name
is used and purged with success, it is added back
to the pool so it can be reused many times.
The following code:
counter = 1
counter = 2
Is now rewritten internally to:
counter = 1
counter@1 = 2
Which gives us a couple things:
1. Better debugging
2. We can now show warnings for rebound variables not used
Elixir also keeps `_@` prefix to store internal variables
(for example, `_@1`, `_@MODULE`, etc).
Closes#607.
Such callbacks are invoked after each process is spawned.
This commit also refactors ExUnit.Runner slightly to consume
information from ExUnit.Server gradually instead of retrieving
it all up-front. This small step allows us to have ExUnit
running in the background in the future or to run many suites
at once.