Commit Graph
433 Commits
Author SHA1 Message Date
Allen Madsen 6f7ce49aa8 Add describe and module attributes (#9181) 2019-07-03 20:38:19 +02:00
Andrea Leopardi 6b0372afe1 Add test for @describetag outside of describe block (#9180) 2019-06-30 23:28:57 +02:00
José Valim c4468a95de Rewrite start_supervised already started into duplicate_child_name
Closes #9089.
2019-05-28 23:03:05 +02:00
José Valim c72162ab52 Include apps/APP prefix in test locations when running from umbrella root 2019-05-18 22:04:26 +02:00
José Valim 01175743b7 Only keep last expression from doctest 2019-05-07 18:12:12 +02:00
Hans 8d2e15c3af Display the actual doctest code when doctset fails (#8903) 2019-05-07 18:00:21 +02:00
Eksperimental 99d919e0c8 Use "code point" instead of "codepoint" (#8774)
That's the term it is used in the Unicode standard.
2019-02-06 11:21:03 +01:00
Devon Estes 4da4ccdb8c Add ability to filter by more than one line number (#8673) 2019-01-23 13:34:42 +01:00
Fernando Tapia Rico 13179d2958 Augment doctest errors with misplaced opaque types (#8653) 2019-01-22 08:48:10 +01:00
Eksperimental 0da99435c3 Use ID and not id (#8639)
The command used to detect these entries:
ag -s "\b(?<![/:{_\[.])ids?(?![}:_\]])(?!\(\))(?!enti)(?!ea)(?!iom)(?!x)"  --elixir
2019-01-16 19:14:39 +01:00
José Valim 963c3eb61d No longer wrap doctest errors in custom exception
They end-up hiding more information than showing.

Closes #8547
2018-12-31 12:17:44 +01:00
eksperimental 5c35c37768 Replace quotation dash with "--"
While correct, it is reported in  #4408 that it will not display correctly em-dashes in
Windows terminals.
2018-12-11 14:42:29 +01:00
José Valim 1904fe0fb0 Avoid race condition on device re-registering 2018-12-06 14:53:32 +01:00
Emil Lynegaard 00a67e3eea Improve error message in multiline iex doctest (#8462)
The previous indentation error message was of no help
in cases where a doctest had a `iex>` command
with multiline expressions.
2018-12-04 20:24:40 +01:00
José Valim ae644808dd No longer persist dynamically added logger backends (#8424)
Otherwise it is impossible to dynamically remove them,
which partially defeats the point of adding them dynamically
in the first place.

Therefore this commit moves the whole dynamic backend
management to the user.

Closes #8213
2018-11-26 14:36:11 +01:00
Eksperimental 8e73f5e03d Change order in which filter meesage are printed in ExUnit.CLIFormatter (#8342)
It was printing this when running: mix test --only foo

Including tags: [:foo]
Excluding tags: [:test]

which is deceiving beucase the order end up rendering useless the include filter.

Swaps the order then.

Additionally swaps the order in ExUnit.Formatter.format_filters/2 and tests,
while not necessary, maintaining the order is a good thing when it's something related
to precedence.
2018-10-26 09:59:27 +02:00
Eksperimental bbaf2c513c Change the precedence in ExUnit.Filters.eval/4 (#8340)
Fixes issues mentioned in #8335, particularly in this discussion:
https://github.com/elixir-lang/elixir/pull/8335#pullrequestreview-168148010

Tests should be first excluded, then included, and then skipped (if any left).
The only exception to the rule is when we explicitly include tests with :skip filter,
to which the :ok value is returned.
2018-10-26 09:59:04 +02:00
Fernando Tapia Rico 2d19ae4640 Remove backticks from error messages and test desc (#8343)
To keep consistency in the codebase.
2018-10-26 08:38:01 +02:00
José Valim 4e8b13e15b Remove extra empty line 2018-10-25 20:56:39 +02:00
José Valim 2e5b941a34 Remove @doc from tests 2018-10-25 20:56:00 +02:00
Eksperimental 5396a8b6b6 Check for line ending in output messages (#8319)
Check for line ending in output messages in ex_unit_tests.exs and beginning of line when applicable. This makes sure we check for the full line,
avoiding unexpected results appearing at the end of the line. Related discussion:
https://github.com/elixir-lang/elixir/pull/8312#discussion_r226867015

Remove on_exit_reload_config/0 and replace it with configure_and_reload_on_exit/1
2018-10-23 10:09:21 +02:00
Eksperimental de9207895b Do not count invalid and excluded twice if setup_all fails 2018-10-21 19:56:18 +02:00
Eksperimental 7aa3918885 Update failure message in ExUnit setup_all callback (#8310)
It is all the module that have been invalidated, not only one.
2018-10-21 10:43:48 +02:00
Eksperimental b95cea5345 General documentation improvements (#8302) 2018-10-20 10:09:03 +02:00
Eksperimental a9db45208b Touch up max_failures tests in ExUnit (#8294)
- Use setup_all instead of "setup all"
- Rename tests from "pass" to "fail" as the names were inverted
2018-10-20 10:07:39 +02:00
eksperimental 8c373044dc Introduce ExUnit --max-failures feature
This adds the --max-failures flag to `mix test` task.
When N number of failures is reached, the suite will
be aborted, and return a the total number of tests
finished upto that moment, along with the failures.
If a module is invalid, all its tests are counted as
as failure even though they are reported as invalid.
2018-10-12 16:00:02 +02:00
Eksperimental 8daec24b8f ExUnit: Replace truthy and falsy functions in assertion tests (#8267) 2018-10-11 07:39:38 +02:00
Eksperimental 6a9dd90bfb Use setup_all instead of "setup all" to refer to the callback (#8266)
[ci skip]
2018-10-10 01:08:16 +02:00
Eksperimental 979969c9a5 Improvements in ExUnit documentation and error messages (#8192) 2018-09-18 09:49:11 +02:00
Fernando Tapia Rico 8b7640fdae Do not run doctests with empty :only option (#8108) 2018-08-20 13:02:49 +02:00
Fernando Tapia Rico ee737d5426 Use refute_received to not wait for the timeout (#8091) 2018-08-16 12:24:10 +02:00
Devon Estes 19464f0c8a Implement ExUnit.after_suite/1 callback (#8087)
It is executed upon the completion of the test suite.
2018-08-16 12:19:31 +02:00
José Valim 4f84f1bf2f Ensure Macro.expand/2 does not change the meaning of interpolations 2018-08-11 20:42:24 +02:00
Anastasiya Dyachenko 068ce0b89b show last n messages from mailbox on assert receive fail (#8039) 2018-08-04 00:19:16 +02:00
José Valim 36d446a8b5 Consistently expand patterns and guards in assertions (#8000)
Closes #7999
2018-07-28 19:14:01 +02:00
José Valim 35ac568044 Require Erlang/OTP 20+ 2018-07-12 12:12:00 +02:00
José Valim 32450a0fd9 Remove Code.get_docs/2 and streamline the new chunk generation 2018-07-05 10:31:23 +02:00
José Valim 5ab60299b5 Do not break assertion arguments apart if they are all quoted literals 2018-06-21 16:41:05 +02:00
Devon Estes cd235357ac Change :type to :test_type and properly document (#7720)
Type is now no longer a reserved key in ExUnit, and we're now
documenting that `:test_type` is a key that is automatically set
by ExUnit, but that it is available for users to override if they would
like.
2018-06-02 11:16:56 +02:00
Wojtek Mach daf5ed3d5c Add "@impl true" to Exception callbacks (#7681) 2018-05-16 09:28:58 +02:00
Aleksei Magusev cd35e84576 Avoid double matching on struct name in ExUnit.Diff 2018-05-11 09:44:49 +02:00
Aleksei Magusev e079a9331c Simplify improper lists handling in ExUnit.Diff 2018-05-11 01:00:58 +02:00
Aleksei Magusev 72f037e592 Improve diff output for subset lists 2018-05-10 22:01:40 +02:00
Devon Estes 44f9635539 Make ExUnit formatting be better for subset lists (#7651)
Sometimes if we were calculating the diff for two lists, one of which
was a subset or superset of the other, then we wouldn't give a very
helpful diff. This makes sure that for subsets and supersets, we give
the best possible diff.
2018-05-10 20:59:53 +02:00
José Valim 70f2d469ff Remove extra whitespace in test file 2018-05-10 15:49:46 +02:00
José Valim 9130a388ee Unify tuple and list logic in ExUnit.Diff 2018-05-10 15:45:46 +02:00
José Valim 75541cf472 Condititionally compile and lazily compute __STACKTRACE__ (#7648)
Erlang/OTP 20 warns if the stacktrace is read outside of a
catch/rescue. This commit mirrors this behaviour by consistently
warning on `System.stacktrace/0` being used outside of a
catch/rescue.

Erlang/OTP 21 warns whenever System.stacktrace/:erlang.get_stacktrace
are used. Therefore we need to promote the usage of `__STACKTRACE__`
and make sure to conditionally compile it according to the OTP version.
This requires changes to the Exception normalization mechanism
so we compute `__STACKTRACE__` only when strictly required.

In future Elixir releases, `System.stacktrace/0` will warn when
used even inside catch/rescue.
2018-05-07 15:33:36 +02:00
Eric Watson 2f5c147ac1 Add diff to doctest (#7585)
Pass both left and right values into `test_case_content`, so that failures get
diff highlighting
2018-04-23 22:24:38 +02:00
José Valim 8803748319 Do not skip parens on in_tmp/in_fixture 2018-04-17 12:49:44 +02:00
José Valim 3c1a6db968 Validate timeout in assert_receive, closes #7470 2018-03-20 08:04:09 +01:00