Commit Graph

54 Commits

Author SHA1 Message Date
Martin Hořeňovský
b79a83e4aa
Modify generator tracking to allow GENERATEs between SECTIONs
This means that code such as

```cpp
TEST_CASE() {
    SECTION("first") { SUCCEED(); }
    auto _ = GENERATE(1, 2);
    SECTION("second") { SUCCEED(); }
}
```

will run and report 3 assertions, 1 from section "first" and 2
from section "second". This also applies for greater and potentially
more confusing nesting, but fundamentally it is up to the user to
avoid overly complex and confusing nestings, just as with `SECTION`s.

The old behaviour of `GENERATE` as first thing in a `TEST_CASE`,
`GENERATE` not followed by a `SECTION`, etc etc should be unchanged.

Closes #1938
2020-07-11 23:16:07 +02:00
Martin Hořeňovský
cbbebb65b6
Fix copy paste error in 7-arg TEMPLATE_TEST_CASE_SIG implementation
Closes #1954
2020-06-13 15:46:59 +02:00
Martin Hořeňovský
9500ded83b
Improved generator tracking
* Successive executions of the same `GENERATE` macro (e.g. because
of a for loop) no longer lead to multiple nested generators.
* The same line can now contain multiple `GENERATE` macros without
issues.

Fixes #1913
2020-06-01 19:06:51 +02:00
Martin Hořeňovský
37cbf4a4fe
Add more tests for test spec parser
Originally the tests were from #1912, but as it turned out, the issue
was somewhere else. Still, the inputs provided were interesting, so
they are now part of our test suite.
2020-04-17 21:19:18 +02:00
Martin Hořeňovský
5d32ce26f4
Fix bug in test spec parser handling of escaping in ORed patterns
It did not clear out all of its internal state when switching from
one pattern to another, so when it should've escaped `,`, it took
its position from its position in the original user-provided string,
rather than its position in the current pattern.

Fixes #1905
2020-04-12 18:48:52 +02:00
Martin Hořeňovský
3701c2e2e6
Small cleanup of self tests 2019-08-04 13:50:25 +02:00
Martin Hořeňovský
4e32e0a563
Fix vendored dep because upstream is non-responsive
Eventually this needs to be fixed in the textflow project by Phil,
but he has not done so in the half a year this bug has been known
to be there, so...

Closes #1470
Closes #1455
2019-04-10 20:17:25 +02:00
Ziv Shahaf
8af8704089 support for printing test filters (PR #1585) 2019-04-03 20:24:52 +02:00
Martin Hořeňovský
1a03918455
Force flush streams in tests for #1514
This avoids the problem where writes to stderr/stdout stop being
line-buffered when stderr/stdout is redirected to a file, which led
to different order of outputs between Linux and Windows in our tests.
2019-03-06 21:53:26 +01:00
Martin Hořeňovský
28db5ed4c9
Add tests for #1514
If the regression comes back, it will only be caught by approvals,
but that's better than nothing.
2019-03-02 21:22:47 +01:00
Martin Hořeňovský
29b3b7ae6b
Namespace our type traits in catch_meta
Previously they could conflict with user-defined type traits that
were in the global namespace.

Fixes #1548
2019-02-23 21:06:20 +01:00
Jozef Grajciar
489a41012e ConsoleReporter: minor formatting fix
PASSED will now appear on the same line as filename and line number,
just like the case with FAILED message formatting
2018-11-10 19:35:25 +01:00
Martin Hořeňovský
6b9ca0888a Add tests for #1404 2018-10-13 16:53:44 +02:00
Martin Hořeňovský
aaaac35d92 Add tests for #1403 2018-10-13 16:53:30 +02:00
Barry
200d3ad824 Support for parenthesizing types with commas. 2018-04-20 15:11:09 +02:00
Martin Hořeňovský
ab30621138 Fix stringifying static array of unsigned chars
The fix leaves an open question: should we keep treating refs
to static array of chars as strings, or should we instead
use `strnlen` to check if it is null-terminated within the buffer

Fixes #1238
2018-04-06 11:43:12 +02:00
dvirtz
ca8470fbad https://github.com/catchorg/Catch2/issues/1175 - don't list hidden tests by default 2018-02-09 19:55:40 +01:00
Martin Hořeňovský
de36b2ada6 Fix compilation for types where relops don't return bool
Closes #1147
2018-01-12 15:49:56 +01:00
Phil Nash
74d3dfd4cc All tests files have .tests.cpp suffix. Also moved tests out of TestMain.cpp and moved up a level 2017-11-13 16:03:27 +00:00
Martin Hořeňovský
b74d4ca96d Add compilation test for #1027 2017-11-13 10:07:06 +01:00
Phil Nash
05b1ca2884 Fixed expansion of _FALSE binary expression
- see #1051
2017-10-13 19:45:19 +01:00
Phil Nash
6105282c4f Removed function pointer comparison test from approvals as it has different serilaisation behaviour in MSVC 2017-09-07 15:04:30 +01:00
Martin Hořeňovský
b000411434 Stop accepting non-const comparison operators
A) non-const comparison operators should not exist and should not be
encouraged

B) The logic breaks comparing function pointers certain way

C) It was inconsistent anyway, as it only applied to `==` and `!=`

Closes #925
2017-09-06 15:01:03 +02:00
Martin Hořeňovský
61d2c375dd Add evaluation specialization for T* and long
Fixes #1005
2017-08-30 12:11:41 +02:00
Martin Hořeňovský
f06ed856d8 Cherry picked 4f21bb72ff (Add tests for #961) from master
- had to redo the baselines
2017-08-15 12:43:27 +01:00
Martin Hořeňovský
74ab1cd94b Update Baselines 2017-07-20 00:29:19 +02:00
Martin Hořeňovský
07ef028483 Update baselines 2017-06-06 15:07:57 +02:00
Phil Nash
bada67bb72 Rebased approvals 2017-05-05 18:28:04 +01:00
Martin Hořeňovský
33ed1773f4 Reworked stringification layer, removed Catch::toString
Now the order of stringification checks is

1) StringMaker specialization
2) operator<<

toString overloads and specializations have been removed.
2017-05-02 23:51:03 +02:00
Phil Nash
61ac34045c Enabled SFINAE stream test 2017-04-25 14:57:58 +01:00
Phil Nash
714d01c07c approved tests that were correct the first time (previous approvals were erroneous) 2017-04-09 20:40:11 +01:00
Phil Nash
250f0ee7fb Added approvals for “failed as expected” tests 2017-04-07 09:33:19 +01:00
Phil Nash
5dd0639520 Added FAIL_CHECK
Works like FAIL, but does not abort test.
As proposed in #765
2017-03-08 15:42:11 +00:00
Martin Hořeňovský
ace70407a2 Add tests for #835
Also add ErrnoGuard before `isatty` call, because apparently it can set
errno to 25 (ENOTTY).
2017-03-06 22:07:33 +01:00
Phil Nash
d6b8ac5a4e Added compilation tests to approvals 2017-02-10 11:53:29 +00:00
Martin Hořeňovský
7db4d8d90c Added tests (single char pretty printing + op overload)
Tests for issue #809 -- Potentional operator overload ambiguity -- and
PR #646 -- Pretty print characters.
2017-02-07 13:32:48 +01:00
Phil Nash
62cbde369e Exclude test name from approval tests 2017-01-09 14:37:28 +00:00
Phil Nash
79acc0504b Sort test ordering during Approval testing 2016-11-29 11:32:16 +00:00
Phil Nash
447f53e9e3 Fixed !shouldfail 2016-03-14 19:13:34 +00:00
Phil Nash
2fc9de9370 Updated approvals following merge of develop back to master 2015-05-18 18:11:58 +01:00
Phil Nash
886ef1620a Some minor tidy-up/ style alignment of recent toString merges 2014-09-04 07:27:09 +01:00
Phil Nash
5ea3266857 Added baselines for new test cases 2014-09-03 19:22:47 +01:00
Phil Nash
cb8fe472b2 Approvals for develop branch 2014-08-22 08:13:47 +01:00
Phil Nash
3ff3acf46c Approvals for last change 2014-07-09 19:21:44 +01:00
Phil Nash
d89e74faff Format floats like doubles when printing - but add ‘f’ suffix (a lá #291) 2014-07-09 18:16:40 +01:00
Phil Nash
08e5296720 Regenerated single include and baselines 2014-07-03 19:08:44 +01:00
Phil Nash
9c1f9a8f9a Added [!mayfail] tag to indicate test case that can fail without failing the suite.
Overhauled the summary report (including the expected failure count)
2014-07-03 08:09:57 +01:00
Phil Nash
baf181f15d Minor fixes to a couple of test names 2014-05-20 18:11:43 +01:00
Phil Nash
1aa60fada9 Changed Approx::toString() to be implemented in terms of toString( double ) (as proposed in #233) 2013-12-19 18:41:55 +00:00
Phil Nash
337dc25ed7 Converted all test case names to "modern" style (freeform text + tags) 2013-11-19 07:21:03 +00:00