José Valim
9f984f82d2
Raise on dedented code in doctests
2023-08-27 11:00:57 +02:00
José Valim
a9f650a9e9
Fix infinite loop when diffing functions, closes #12828
2023-08-02 20:45:51 +02:00
Vinícius Müller
48b471d055
Update diagnostics reporting format ( #12813 )
2023-07-20 18:49:55 +02:00
kevinferretti
67207f4b75
Improve default ExUnit seed algorithm and allow changing via config ( #12733 )
2023-07-01 19:17:38 +02:00
José Valim
70bbfd0964
Refactor doctest tests
2023-06-28 22:32:02 +02:00
Rich Cavanaugh
8cbea343ee
Allow variables defined in doctests to be used in expectation ( #12730 )
2023-06-28 22:28:45 +02:00
Jean Klingler
c312b47d08
Always respect options passed to capture_log ( #12721 )
2023-06-27 20:56:08 +09:00
José Valim
0a66246e97
Fix doctest suite
2023-06-26 21:13:22 +02:00
Vinícius Müller
a9e826e3bb
Assert on relative lines in doctest tests ( #12699 )
2023-06-23 00:03:17 +02:00
José Valim
d80a567532
Fix non-result doctest terminated with fences, closes #12695
2023-06-22 19:05:43 +02:00
José Valim
f01df3dcb7
Add doctest_line interpolation
2023-06-22 18:12:29 +02:00
José Valim
be4a62aa7e
Avoid trailing whitespace on ExDoc messages
2023-06-22 14:46:11 +02:00
Vinícius Müller
0da6662b5e
Improvide diagnostics on lexer exceptions ( #12670 )
2023-06-19 11:07:59 +02:00
nico piderman
79c89c84ae
Mark test cases as invalid when an exit occurs during setup_all ( #12651 )
2023-06-12 12:52:17 +02:00
Wojtek Mach
1e3341382f
Fix Macro.to_string/1 and ExUnit diffs for multi-letter sigils ( #12627 )
2023-06-01 16:17:51 +02:00
José Valim
8e0f3621b2
Include doctest_data in doctest tags
2023-05-30 20:20:57 +02:00
José Valim
491cf4f131
Fix doctest line failure with multiple assertions
2023-05-30 19:34:52 +02:00
José Valim
e6c052dbf5
Refactor doctests for upcoming bug fixes
2023-05-30 18:11:58 +02:00
Zach Allaun
f2ab40bfdb
Expose compile-time test and tag information ( #12608 )
2023-05-29 09:36:01 +02:00
José Valim
677bdd24f1
Fix regression in doctests
2023-05-26 18:17:19 +02:00
José Valim
8448600ebf
Fix doctest lines when compilation fails, closes #12607
2023-05-26 12:44:52 +02:00
José Valim
ea31af5944
Refactor doctests suite for maintanability
2023-05-26 12:04:12 +02:00
José Valim
0dadb08ac7
Allow capturing deprecated log level, closes #12605
2023-05-25 15:24:27 +02:00
Damir Vandic
ef673a103d
Pass module tags to setup_all ( #12545 )
2023-05-07 12:57:44 +02:00
José Valim
80dc08c4ae
Fix race conidtion on ExUnit suite
2023-03-08 10:43:27 +01:00
Andrea Leopardi
8405180ebc
Use Erlang logger handlers in ExUnit.CaptureLog ( #12408 )
2023-02-17 07:54:24 +01:00
José Valim
318dd5297b
Introduce default_formatter and default_handler config for Logger ( #12400 )
...
We now fully integrate with Erlang/OTP logger.
* Logger.Formatter can now instantiate a compatible Erlamg/OTP logger formatter
* The default_handler configures the default handler
* The default_formatter configures the default formatter
* Backends front-end will be moved to logger_backends package,
but the implementation will still be shipped as part of Elixir
2023-02-15 17:31:18 +01:00
Andrea Leopardi
ac8a4a3d1b
More errors improvements in ExUnit.Callbacks ( #12390 )
2023-02-10 10:12:28 +01:00
Andrea Leopardi
9881163ace
Improve errors for ExUnit callbacks ( #12382 )
2023-02-10 08:14:51 +01:00
felipe stival
b3cc3dd47c
Accept {module, function} tuples in ExUnit setup ( #12378 )
2023-02-05 21:42:08 +01:00
José Valim
42af91d6ac
Move capture logging inside the test process
2023-01-28 12:13:03 +01:00
José Valim
569664cff9
Diff function environment on ExUnit.Diff
2022-12-13 15:58:59 +01:00
José Valim
7f97feaaa8
Return values from running doctests and order tests
2022-12-01 13:21:25 +01:00
José Valim
b24869687b
Introduce mechanism to collect several errors in a module ( #12275 )
2022-11-28 15:40:30 +01:00
José Valim
07b7be6e33
Do not quote doctest excerpt
2022-11-23 18:01:11 +01:00
José Valim
579e301102
mix format
2022-11-03 11:58:52 +01:00
José Valim
d9150205c9
Add doctest metadata as tags
2022-11-03 11:50:09 +01:00
José Valim
ee899022ce
Improvements to ExUnit
...
* Do not run duplicate cases on ExUnit.run/1
* Allow test cases to not be registered on use
* Expose ExUnit.Formatter.format_assertion_diff/4
2022-10-31 15:30:42 +01:00
José Valim
7d0e436b0d
Recurse over macro expansions in assert
2022-10-21 18:21:44 +02:00
José Valim
4be87ff1b2
Do not expand or collect vars from quote in ExUnit assertions
...
See #12209 .
2022-10-21 15:57:48 +02:00
Wojtek Mach
009b885672
Add ExUnit.DocTest.doctest_file/2 ( #12150 )
2022-09-27 18:00:16 +02:00
José Valim
6170604e6c
Do not crash when moduledoc and other functions are listed in only, closes #12120
2022-09-07 16:19:49 +02:00
sabiwara
0f531b9f22
Fix ExUnit.Diff handling of charlists ( #12073 )
2022-08-13 08:50:15 +02:00
sabiwara
29bf449f3f
Evaluate formating charlists as ~c sigils ( #12064 )
2022-08-10 06:47:00 +02:00
José Valim
76a683f41c
Add deprecations
2022-07-27 17:18:53 +02:00
José Valim
1b60acbe9e
Allow LINE to be set for tests
2022-07-18 09:58:14 +02:00
LJZN
03b53d3eb2
Fix ExUnit assertion when operator is overriden ( #11929 )
...
Closes #11885
2022-06-20 16:52:06 +02:00
José Valim
c0a3c6569c
Dont change the exception type
2022-06-17 10:28:21 +02:00
Dimitris Zorbas
2dc9bb4bae
Display friendly error when test name is too long ( #11844 ) ( #11864 )
...
This commit changes ExUnit.Case to show a more specific error message
when the test name is too long that would cause SystemLimitError.
2022-06-17 10:26:18 +02:00
Matt Glover
d090be63a0
Improve ExUnit's diff output for pinned struct match failures ( #11923 )
...
* Tests for expected assert output on pinned struct match failure
ExUnit's diff formatter raises when a match fails between a struct and
non-struct type when pins are involved. The error is:
```
** (FunctionClauseError) no function clause matching in Macro.inspect_atom/2
The following arguments were given to Macro.inspect_atom/2:
# 1
:literal
# 2
{:^, [line: 300], [{:expected_module, [line: 300], nil}]}
Attempted function clauses (showing 4 out of 4):
def inspect_atom(:literal, atom) when atom == nil or is_boolean(atom)
def inspect_atom(:literal, atom) when is_atom(atom)
def inspect_atom(:key, atom) when is_atom(atom)
def inspect_atom(:remote_call, atom) when is_atom(atom)
```
The desired behavior respects the pin operator rather than trying to
treat it as if it were a literal.
* ExUnit diff algebra improved pinned struct type support
Ensure that the diff algebra generation process can handle a case where
the left element has a pinned struct type and the right element is not a
struct. In this case render the pin info and display the pin variable
in the test output.
This prevents ExUnit's diff process from raising for asserts like:
```
assert %^type{} = nil
assert %^type{} = :not_a_struct
```
2022-06-14 13:39:01 +02:00