Commit Graph
1290 Commits
Author SHA1 Message Date
felipe stival edcb9096d5 Show code snippet on syntax and token missing errors (#11332)
Closes #11280.
2021-10-25 16:18:29 +02:00
Udo Kramer 95357ff453 Fix a few typos (#11342) 2021-10-25 12:32:42 +02:00
José Valim dc753d6a05 Show hint if comparing different but equivalent strings
Closes #11256.
2021-10-21 12:06:35 +02:00
Riccardo Manfrin 2af04119b9 Print Erlang levels in :console backend (#11304) 2021-10-09 16:56:30 +02:00
José Valim aff0cf17d3 Run formatter 2021-10-05 12:51:39 +02:00
José Valim 4ba9bd82ad Support CRLF in doctests, closes #11291 2021-10-05 12:46:10 +02:00
José Valim a3f790e7f6 Parameterize doctest assertions with lines 2021-10-05 12:45:26 +02:00
José Valim 92320e50b6 Do not pass invalid AST to code formatter in ExUnit
Also include the stacktrace on Exception.message/1 failure.
2021-08-19 11:29:12 +02:00
Wojtek Mach 9535b412e3 Improve ExUnit.CaptureLog docs (#11141) 2021-07-25 10:38:25 +02:00
Wojtek Mach 63ee33ada8 Improve ExUnit.CaptureIO docs (#11140) 2021-07-25 09:10:56 +02:00
Marc-André Lafortune 1204917a47 Add with_log and with_io (#11139) 2021-07-24 23:53:21 +02:00
José Valim 58eaeb954c Simplify ExUnit runner 2021-07-22 20:23:25 +02:00
Wojtek Mach 039f29f24f Make doctest work for "Erlang" modules (#11134) 2021-07-22 11:55:48 +02:00
Jonathan Arnett 4d318398b0 Change exit status for test failures to 2 (#11119) 2021-07-15 22:37:15 +02:00
José Valim 9e9f44beaf Only add at_exit if failures are positive 2021-06-30 17:19:39 +02:00
Anil Wadghule 46cf795804 Update sigil_r use as per docs (#11070) 2021-06-19 20:21:50 +02:00
Quinn Wilton 440fac4b15 Warn if ?\lettter is used but there is no such escape sequence (#11042)
This resolves #11028
2021-06-06 20:19:55 +02:00
Quinn Wilton b529d44086 Invalidate a module's tests in RunnerStats if that module fails
This change is needed for two reasons:
1) To exit with a non-zero code if a module's tests are invalidated
2) To add any invalidated tests to the FailuresManifest
2021-06-06 19:27:46 +02:00
Quinn Wilton ccda8219e9 Fix the failures count when an on_exit hook errors in setup_all
The bug here was that `config` wasn't being updated with the new
count, so the failures would be output, but the final count would
not be correct.

Note that when updating the count we need to only include the
successful tests, to avoid counting each failed test twice.
2021-06-06 19:27:46 +02:00
José Valim 4ae5d5d3da Use Code.quoted_to_algebra on Macro.to_string (#11003) 2021-05-24 16:00:57 +02:00
Jason Axelson fb7b8f4b05 Improve ExUnit seed docs (#10962)
Make it more obvious what a seed of 0 does.
2021-05-01 19:38:18 +02:00
José Valim d34a828b48 Fix Mix suite with async_run and await_run 2021-04-09 00:08:20 +02:00
José Valim bf71eee6fb Support explicit ExUnit.run 2021-04-08 23:01:24 +02:00
José Valim 14b0f20938 Do not copy whole test config to test process 2021-03-31 13:33:31 +02:00
José Valim 84ffdb0057 Do not discard blamed stacktrace from exception in exit in ExUnit formatter 2021-03-30 16:16:21 +02:00
Wojtek Mach f33c614f86 Make ExUnit tmp_dir absolute (#10826) 2021-03-27 20:03:06 +01:00
Eric Meadows-Jönsson dedee1d85a Fix OTP 24 test warnings (#10817) 2021-03-25 17:41:04 +01:00
Marco Milanesi 3fff5c4e43 Handle assert [%_{}] = [] (#10811) 2021-03-24 22:49:05 +01:00
José Valim 6a42cfe3e3 Further trim down generated doctest size 2021-03-05 10:32:44 +01:00
José Valim 4d2be245c0 Avoid generating large ASTs on doctests
This makes the 633 doctests in Nx compile 4x faster.
2021-03-04 15:55:36 +01:00
Damir Vandic 3e453df186 Fix docs example in ExUnit.Case (#10754) 2021-02-26 10:00:27 +01:00
Christopher Keele 1b345edf15 Minor typo fix in ExUnit.DocTest moduledocs (#10711) 2021-02-14 08:16:51 +01:00
Devon Estes 2153b09bd4 Interpolate module attributes in match assertions (#10686)
This will interpolate the value of module attributes in match assertions
in ExUnit. Basically, the old diff would look like this:

```
  1) test assert match with module attribute (ExUnit.AssertionsTest)
     test/ex_unit/assertions_test.exs:186
     match (=) failed
     code:  assert {2, @test_mod_attribute} = Value.tuple()
     left:  {2, @test_mod_attribute}
     right: {2, 1}
     stacktrace:
       test/ex_unit/assertions_test.exs:187: (test)
```

And now it will look like this:

```
  1) test assert match with module attribute (ExUnit.AssertionsTest)
     test/ex_unit/assertions_test.exs:186
     match (=) failed
     code:  assert {2, @test_mod_attribute} = Value.tuple()
     left:  {2, 2}
     right: {2, 1}
     stacktrace:
       test/ex_unit/assertions_test.exs:187: (test)
```
2021-02-03 17:44:33 +01:00
José Valim 3df3117c15 Run formatter 2021-01-30 00:10:59 +01:00
José Valim e8678f339b Blow up on bad inspect in doctest 2021-01-29 20:56:32 +01:00
Wojtek Mach 78fa1763e4 Update context error test (#10657) 2021-01-15 14:42:34 +01:00
felipe stival 8c26ddbc67 Improve error message on invalid pattern on test (#10649) 2021-01-15 09:17:57 +01:00
José Valim e5a2f71e1b Add System.trap_signal/3 and System.untrap_signal/2 (#10650) 2021-01-13 09:30:39 +01:00
José Valim 6fc064a1af Consider sync time only when sync tests start 2021-01-12 13:10:36 +01:00
Tonći Galić 01477e6f1b Prevent using wrong test context (#10647)
setup blocks can return 3 shapes:
 - result tuple: {:ok, new_context}
 - (keyword) list: [conn: new_conn]
 - map: %{conn: conn}

the return values of setup blocks get merge into a map and passed as a map to
test context. users could however make a mistake by using (for example) a
keyword list as pattern for test context, which will return a function clause
error. this commit tries to return a more friendly error instead
2021-01-12 13:05:12 +01:00
José Valim 045e3b4855 Print how much time is spent on async/sync tests
~/OSS/ecto[master]$ mix test
    ...................................................
    ............. (...)

    Finished in 9.1 seconds (7.9s async, 1.2s sync)
    78 doctests, 1089 tests, 0 failures
2021-01-09 11:44:22 +01:00
José Valim 5adbaf3728 Consider macros and module attributes on the left side of ++ on ExUnit.Diff
Closes #10520
2020-12-01 07:43:37 +01:00
José Valim af5494657c Add more examples to assert/2, closes #10503 2020-11-29 11:11:26 +01:00
José Valim 55c4f74f2b Improve error message on multiple doctest exceptions 2020-11-22 10:29:26 +01:00
Gustavo Saiani b4de082432 Two minor doc fixes in ExUnit.Callback (#10472) 2020-11-02 13:07:40 +01:00
Saša Jurić 1dcce6309c Fix stop_supervised/1 for temporary children (#10442) 2020-10-18 21:37:12 +02:00
José Valim e7cf3016bd Fix handle_call return type 2020-10-07 07:48:28 +02:00
José Valim 285a6a6f84 Intercept sigquit on ExUnit
By using `Ctrl+\ ` to shutdown the VM, ExUnit will
intercept the sigquit signal and print the tests
currently running. This can be used to see which
test is stuck in a long running test suite:

    $ mix test
    .^\

    Aborting test suite, the following have not completed:

    * test greets the world [test/example_test.exs:5]
    * AnotherTest [test/another_test.exs]

    Showing results so far...

    1 doctest, 0 failures

    Randomized with seed 825614

As shown above, we also include a summary of the run
so far, alongside the seed and failure reports.
2020-10-06 12:20:59 +02:00
José Valim b1d9f3da66 Return an empty map instead of none for public but undocumented functions 2020-09-18 11:59:44 +02:00
José Valim d6ccfa444e Speed up compilation with multiple describe 2020-09-17 14:24:49 +02:00