Commit Graph

3262 Commits

Author SHA1 Message Date
Martin Hořeňovský 40937b67c7
Merge pull request #1983 from s7726/patch-1
Update catch_reporter_tap.hpp
2020-07-12 20:00:03 +02:00
Martin Hořeňovský 0d5b131394
Improve documentation for --min-duration 2020-07-12 16:27:55 +02:00
Martin Hořeňovský ad3b90553b
Document GENERATE's new usage between SECTIONs 2020-07-12 16:24:32 +02:00
Gavin S b1c45652e5
Update catch_reporter_tap.hpp
TAP format requires all results to be reported.
Removed extraneous preferences function (handled by parent)
Incorporated fix from 3d9e7db2e0
Simplified total printing
2020-07-12 01:17:37 -07:00
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ý 89fe35d515
Fix how testRandomOrder.py builds tag arguments 2020-07-11 21:32:10 +02:00
Martin Hořeňovský 115d6a1c40
Increase tolerances in --min-duration tests
The underpowered and oversubscribed CI servers are hell.
2020-07-07 11:36:56 +02:00
Martin Hořeňovský 91576352f9
Fixup single_include to be consistent with last tag
Closes #1975
2020-07-07 11:32:05 +02:00
Martin Hořeňovský 6f7c191513
--min-duration is overriden by -d no 2020-07-06 20:33:08 +02:00
Martin Hořeňovský 4eb9d37e05
Refactor tests for duration reporting threshold 2020-07-06 20:02:20 +02:00
John Bytheway 53d8af8e96 Test for --min-duration 2020-07-06 11:35:02 +02:00
John Bytheway 46fde0c597 Add --min-duration option
A test runner already has a --durations option to print durations.
However, this isn't entirely satisfactory.

When there are many tests, this produces output spam which makes it hard
to find the test failure output.  Nevertheless, it is helpful to be
informed of tests which are unusually slow.

Therefore, introduce a new option --min-duration that causes all
durations above a certain threshold to be printed.  This allows slow
tests to be visible without mentioning every test.
2020-07-06 11:35:02 +02:00
Martin Hořeňovský de103db696
Merge pull request #1973 from echuber2/patch-1
Escaping "*" ("times") to fix Markdown presentation
2020-07-06 11:34:22 +02:00
Eric Huber fedc3a7b7b
Escaping literal "*" ("times") to fix markdown 2020-07-05 17:04:00 -05:00
Martin Hořeňovský c299133a31
v2.12.4 2020-07-05 11:51:30 +02:00
Martin Hořeňovský 09b8017ea3
Update FUNDING file (-Patreon, +PayPal) 2020-07-04 20:06:27 +02:00
George Rhoten bad3c93049 Fix for macOS on ARM 2020-07-01 19:28:50 +02:00
Martin Hořeňovský 0f05c034c2
v2.12.3 2020-06-29 20:50:39 +02:00
Ryan Pavlik ee4538c0c6 Add OverallResultsCases element to XML reporter 2020-06-28 22:36:08 +02:00
Martin Hořeňovský dc7a20fc74 Rewrite the contributing documentation 2020-06-27 17:44:08 +02:00
Martin Hořeňovský 018dc0b74f
Replace a TODO comment in examples 2020-06-26 20:04:05 +02:00
Richard Ash ad1940f336 Add an example of using GENERATE(table())
There are some examples on issue #850 of using this feature, but they
are not easily found from the documentation. Adding them here as an
example makes them more findable and ensures they keep working if the
API changes.
2020-06-23 22:55:03 +02:00
Richard Ash 5399921622 Add notes on compiling the examples.
This took me some time to figure out so document for others.
2020-06-20 21:41:10 +02:00
offa e815acddf8 Clang-format configuration added.
Some notes on the configuration options chosen:

* We want `AllowShortEnumsOnASingleLine` set to `false`, but that
option is clang-format-11 and up, which is not out yet.
* `IndentPPDirectives` is currently inconsistent, but `AfterHash`
is the preferred style in new code.
* `NamespaceIndentation` is a mess, but `All` is closer to the effect
we want than `Inner`.
* `SpacesInParentheses` set to `true` is not ideal due to it also
introducing extra spaces in preprocessor expressions, but using it
is much closer to the current style than not.

All in all, using this setting globally would reformat pretty much
every line of code in the codebase, but it is as close as possible
to the bespoke style currently used. Still, it should only be used
on the diffs.

Closes #1182
2020-06-19 09:49:10 +02:00
Richard Ash e7189f1e4f Make scripts/updateDocumentToC.py executable.
On systems where the file system has excute permissions, this script was
not marked as executable in a clean git checkout and so could be run
without first changing the permissions. Fixed by setting the relevant
git flag.
2020-06-18 21:28:08 +02:00
Martin Hořeňovský 1806b21545
Add explicit test for shortcircuiting behaviour of combined matchers 2020-06-14 21:48:08 +02:00
Martin Hořeňovský 288416f501
Devirtualize NameAndLocation query on trackers 2020-06-13 19:26:17 +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ý fb08596b1b
Clarify documentation about nested generators
Closes #1947
2020-06-13 11:12:12 +02:00
Matthias Blankertz 0614a4acb3 Hide std::exception_ptr and friends if exceptions disabled
Some compilers, e.g. the Green Hills C++ compiler, react badly to the
appearance of std::exception_ptr, std::current_exception,
std::rethrow_exception and std::uncaught_exception(s). To allow usage of
Catch2 with these compilers when exceptions are disabled, hide the usage
of std::exception_ptr etc. when compiling with
CATCH_CONFIG_DISABLE_EXCEPTIONS.
2020-06-12 23:23:55 +02:00
Martin Hořeňovský 0f12995501
Fix compilation of examples 2020-06-01 21:27:58 +02:00
Martin Hořeňovský 0807fdb175
Replace stray tabs with spaces 2020-06-01 19:06:51 +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
bogdasar1985 6c6ebe374a fixing UB 2020-05-29 14:56:40 +02:00
Martin Hořeňovský b1b5cb8122
v2.12.2 2020-05-25 15:13:18 +02:00
Martin Hořeňovský 77dc8cfc45
Really fix use of std::result_of when invoke_result is available
Closes #1934
2020-05-22 10:05:34 +02:00
Martin Hořeňovský ddc9f4c61d
Avoid using std::result_of when std::invoke_result is available
Closes #1934
2020-05-21 21:39:19 +02:00
Martin Hořeňovský bed47374ce
Remove obsolete comment in UnorderedEquals vector matcher 2020-05-18 14:29:50 +02:00
Valentin Tolmer 0e9bae1cdb Create a BUILD file for compatibility with bazel
With this change, it's much easier for bazel projects to depend on
Catch. They just need to add:
  - In the workspace:
  ```
http_archive(
    name = "com_github_catchorg_catch2",
    urls = ["https://github.com/catchorg/Catch2/archive/v2.12.1.tar.gz"],
    strip_prefix = "Catch2-2.12.1",
    sha256 = "e5635c082282ea518a8dd7ee89796c8026af8ea9068cd7402fb1615deacd91c3",
)
```
  Or the appropriate version/sha256.
  - For the tests, assuming that `test_main.cc` contains the
  `CATCH_CONFIG_MAIN`:
  ```
cc_library(
    name = "test_main",
    srcs = ["test_main.cc"],
    deps = ["@com_github_catchorg_catch2//:catch2"],
)
```
2020-05-17 13:18:22 +02:00
Martin Hořeňovský f133277910
Add status attribute to JUnit's section reporting
This brings our output inline with GTest's. We do not handle skipped
tests properly, but that should be currently less important than
having the attribute exist with proper value for non-skipped tests.

Thanks @joda-01.

Closes #1899
2020-05-15 21:00:19 +02:00
Martin Hořeňovský f764ee3d30
Document that user can only provide main in TU with CONFIG_RUNNER
Closes #1851
2020-05-15 15:57:27 +02:00
Natsu c190061001
Fix compilation failure when using libstdc++10 (#1929)
The issue is caused by deleted `std::__detail::begin` declared in `bits/iterator_concepts.h`. This would be found by ADL, and because it is deleted, compilation would fail. This change makes it so that we SFINAE on `begin(std::declval<T>())` and `end(std::declval<T>())` being well-formed.
2020-05-15 11:30:12 +02:00
Billy Robert O'Neal III b1dcdc5032 Fix invalid isspace call detected by PREfast
D:\vcpkg\toolsrc\include\catch2\catch.hpp(11285): warning C6330: 'char' passed as _Param_(1) when 'unsigned char' is required in call to 'isspace'.
D:\vcpkg\toolsrc\include\catch2\catch.hpp(11288): warning C6330: 'char' passed as _Param_(1) when 'unsigned char' is required in call to 'isspace'.

ISO/IEC 9899:2011:
"7.4 Character handling <ctype.h>"/1
[...] In all cases the argument is an int, the value of which shall be
representable as an unsigned char or shall equal the value of the macro
EOF. If the argument has any other value, the behavior is undefined.

This means if isspace was passed a character like ñ it could corrupt
memory without the static_cast to treat it as a positive value after
integral promotion (and C libraries commonly use the int index supplied
as a key into a table which result in out of bounds access if the
resulting int is negative).
2020-05-12 14:07:22 +02:00
Martin Hořeňovský f0e596e252
Silence clang-tidy's hicpp-vararg (alias of coreguidelines vararg)
Ideally, clang-tidy would be smart that if one alias of a warning
is suppressed, then the other one is suppressed as well, but as of
right now, it isn't. This means that for now we have to suppress
both aliases of this warning. Opened upstream issue to fix this:
https://bugs.llvm.org/show_bug.cgi?id=45859

Obviously, ideally clang-tidy would also not warn that we are calling
a vararg function when it is an unevaluated magic builtin, but that
also is not happening right now and I opened an issue for it:
https://bugs.llvm.org/show_bug.cgi?id=45860

Closes #1921
2020-05-09 18:23:12 +02:00
Martin Hořeňovský 594cab31ed
Upload conan releases to catch2 remote (instead of Catch2)
At some point we moved over to catch2:catchorg (notice lowercase `c`)
instead of Catch2:catchorg, but we kept uploading the released
packages to the upper-cased repository... Time to fix this, and then
merge them again.
2020-05-06 20:49:26 +02:00
Gareth Lloyd 89f5f84351 Provide path of the cmake scripts to conan 2020-04-23 18:11:41 +02:00
Martin Hořeňovský 2e61d38c7c
v2.12.1
--- Fixes ---
* Vector matchers now support initializer list literals better

--- Improvements ---
* Added support for `^` (bitwise xor) to `CHECK` and `REQUIRE`
2020-04-21 19:30:38 +02:00
Martin Hořeňovský 5c9f09e94a
Add support for bitwise xor to the decomposer 2020-04-21 19:27:12 +02:00
Martin Hořeňovský f4fc2dab2c
Fixup template type argument inference for vector matchers 2020-04-21 19:09:45 +02:00
Martin Hořeňovský cfb6956698
v2.12.0
--- Improvements ---
* Running tests in random order (`--order rand`) has been reworked significantly (#1908)
  * Given same seed, all platforms now produce the same order
  * Given same seed, the relative order of tests does not change if you select only a subset of them
* Vector matchers support custom allocators (#1909)
* `|` and `&` (bitwise or and bitwise and) are now supported in `CHECK` and `REQUIRE`
  * The resulting type must be convertible to `bool`

--- Fixes ---
* Fixed computation of benchmarking column widths in ConsoleReporter (#1885, #1886)
* Suppressed clang-tidy's `cppcoreguidelines-pro-type-vararg` in assertions (#1901)
  * It was a false positive trigered by the new warning support workaround
* Fixed bug in test specification parser handling of OR'd patterns using escaping (#1905)

--- Miscellaneous ---
* Worked around IBM XL's codegen bug (#1907)
  * It would emit code for _destructors_ of temporaries in an unevaluated context
* Improved detection of stdlib's support for `std::uncaught_exceptions` (#1911)
2020-04-21 16:33:15 +02:00