Commit Graph
60 Commits
Author SHA1 Message Date
José Valim 6cee8572e0 Clean up ExUnit tests 2013-06-21 15:16:02 +02:00
vanstee f2d9e802cd Include description and improve formatting
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>
2013-06-21 15:08:48 +02:00
vanstee 561d6ea0d1 Show original statement if assert or refute fails
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
2013-06-20 16:17:55 -04:00
Rafael Mendonça França 7cdc25538e Uniform use of whitespace after commas on codebase
This make easier to read and also follow some standard in the code
2013-06-15 16:52:48 -03:00
Alexei Sholik 4a1dfccbec Use =~ with strings where it makes sense 2013-06-08 15:58:34 +03:00
José Valim c78d3b3717 Clean up DocTestTest 2013-06-05 18:00:26 +08:00
Yuki Ito 1fa29be448 Option that enable to decide whether capture_io captures a prompt or not 2013-06-02 19:15:06 +09:00
Yuki Ito 9840ac266b capture_io captures a prompt when capturing of stdio 2013-06-01 17:07:28 +09:00
Alexei Sholik 4ce444ad76 Include location info in the multiple exceptions error 2013-05-29 00:34:18 +03:00
Alexei Sholik da4565ee88 Don't test DocTest's doctests 2013-05-28 19:07:30 +03:00
Alexei Sholik 7044f9c9da Add a test for leaking vars 2013-05-28 16:36:32 +03:00
Alexei Sholik 5aa5268c5b Implement extended doctest sessions. Closes #1020 2013-05-28 13:53:18 +03:00
Yuki Ito 97ea102a79 Enable ExUnitCaptureIO.capture_io to receive input 2013-05-23 00:45:06 +09:00
José Valim c3d6a96dac Consider load time on ExUnit reports, closes #893 2013-05-21 12:57:22 +02:00
José Valim abc5d6f954 Also allow explicitly capturing of stdio and stderr 2013-05-15 10:19:01 -06:00
José Valim ad2a6774b1 Ensure no group_leader leakage on capture_io and remove stderr test which was printing on run 2013-05-15 10:02:29 -06:00
Yuki Ito 66eb369b3d Implement capture_io for ex_unit 2013-05-15 19:12:50 +09:00
José Valim 8de27bf9af Clean up and speed up exceptions 2013-05-12 20:51:39 -06:00
José Valim cbe82e0912 Add __DIR__, closes #1019 2013-05-06 11:03:37 -06:00
José Valim 5841f6849b Deprecate assert inlist in favor of assert in 2013-05-05 09:52:00 -06:00
Yurii Rashkovskii 6512fcb06e Add import: option to doctests. It is false by default. 2013-04-11 03:29:32 -07:00
José Valim 025c425514 Split doctests that expect an exception from the ones who does not 2013-04-09 23:58:43 -07:00
José Valim 48da7e8ed7 Allow doctests to be defined dynamically 2013-04-09 23:31:09 -07:00
Yurii Rashkovskii dbf711b519 Add support for exception tracking in DocTest 2013-04-09 17:42:54 -07:00
Yurii Rashkovskii 0b0bbdee5e Initial ExUnit.DocTest implementation 2013-04-09 13:42:19 -07:00
José Valim 369fd7506c Ensure unquotes are respected in the test macro 2013-03-26 13:36:54 -06:00
José Valim 4cc92aaf8d Improve formatting for assert left = right 2013-02-28 08:14:57 -07:00
José Valim 6a24bc4ef3 Add elapsed times to ExUnit runs 2013-02-19 08:57:42 -07:00
José Valim 8a58722dd0 ANSIfy ExUnit formatter 2013-02-18 17:57:43 -07:00
José Valim 7dd0aabbe2 Deprecate ExUnit.after_spawn callbacks 2013-02-17 20:46:58 -07:00
José Valim 658d7c7913 ExUnit callbacks must return :ok or { :ok, data } 2013-02-17 20:43:01 -07:00
José Valim 1f491dfbe2 Add support to case templates 2013-02-17 20:43:01 -07:00
José Valim 8f57b4c9af Add metadata support to ExUnit
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
2013-02-17 18:23:31 -07:00
José Valim fda6f0ce09 Move path related functions from File to Path 2013-01-19 09:36:03 -07:00
José Valim 09f61abe27 Add assert_receive and refute_receive to ExUnit 2012-12-26 17:28:10 +01:00
José Valim 0369d1652f Add ExUnit.ExpectationError and move special formating to ExUnit.CLIFormatter 2012-12-17 10:59:41 +01:00
Oren Ben-Kiki 8e2a30906a Align expected and actual values in assertion failure messages. 2012-12-15 00:01:35 +02:00
José Valim 1105781606 ExUnit supports many manual runs 2012-12-08 12:04:26 +01:00
José Valim 2a74f477fc Improve test to verify ExUnit.Runner is not in the stacktrace 2012-12-08 11:55:13 +01:00
José Valim 7e1a79e2a4 Use System.cmd instead of Port.open 2012-12-08 10:39:06 +01:00
mururu 3a4612da87 The default formatter of ex_unit should not prints unneeded stacktraces.
Conflicts:

	lib/ex_unit/lib/ex_unit/cli_formatter.ex
2012-12-08 10:37:42 +01:00
José Valim 3de677607c Deprecated assert left in right in favor of assert left inlist right, closes #662 2012-11-27 15:05:03 +01:00
José Valim 40efeb48d7 Reduce atom footprint when compiling code
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.
2012-11-15 16:44:27 +01:00
José Valim cae328112c Fix unecessary double file read 2012-11-08 13:42:25 +01:00
Yurii Rashkovskii 73d7de7bc9 Add support for ExUnit user configs 2012-11-08 02:49:59 -08:00
José Valim 01f9518899 Keep user's given name when rebinding variables
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.
2012-11-01 12:37:08 +01:00
José Valim cc22787c65 Do actual matching on = assertions 2012-10-30 09:17:16 +01:00
José Valim 6a45bcfc37 Pass context in setup/teardown callbacks 2012-10-11 06:39:53 +02:00
José Valim 52d406dac2 Simplify some assertion tests 2012-09-07 12:19:30 +02:00
José Valim 5df46d54ef ExUnit now supports after_spawn callbacks
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.
2012-09-06 12:52:46 +02:00