Commit Graph

41 Commits

Author SHA1 Message Date
Martin Hořeňovský
e92b9c07c3 Add an experimental new way of capturing stdout/stderr
Unlike the relatively non-invasive old way of capturing stdout/stderr,
this new way is also able to capture output from C's stdlib functions
such as `printf`. This is done by redirecting stdout and stderr file
descriptors to a file, and then reading this file back.

This approach has two sizeable drawbacks:
1) Performance, obviously. Previously an installed capture made the
program run faster (as long as it was then discarded), because a call
to `std::cout` did not result in text output to the console. This new
capture method in fact forces disk IO. While it is likely that any
modern OS will keep this file in memory-cache and might never actually
issue the IO to the backing storage, it is still a possibility and
calls to the file system are not free.

2) Nonportability. While POSIX is usually assumed portable, and this
implementation relies only on a very common parts of it, it is no
longer standard C++ (or just plain C) and thus might not be available
on some obscure platforms. Different C libs might also implement the
relevant functions in a less-than-useful ways (e.g. MS's `tmpfile`
generates a temp file inside system folder, so it will not work
without elevated privileges and thus is useless).

These two drawbacks mean that, at least for now, the new capture is
opt-in. To opt-in, `CATCH_CONFIG_EXPERIMENTAL_REDIRECT` needs to be
defined in the implementation file.

Closes #1243
2018-04-29 22:25:49 +02:00
Martin Hořeňovský
552589f25b
Merge branch 'master' into master 2018-03-07 10:37:50 +01:00
Tomas Zeman
352853ed7e Introduce conditional wchar_t (and std::wstring) support
The support is turned on by default but the user might need to be able
to turn it off which is now possible by defining CATCH_CONFIG_NO_WCHAR.
2018-03-07 10:35:31 +01:00
Josh Soref
b11175548a Fixup various spelling errors (#1208) 2018-03-07 10:08:35 +01:00
Martin Hořeňovský
cf4b7eead9 Document CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS macro
Also fix how it can be disabled.
2018-02-25 21:22:38 +01:00
Martin Hořeňovský
31673ee0ca Document CATCH_CONFIG_DEFAULT_REPORTER macro 2018-02-11 18:10:28 +01:00
Martin Hořeňovský
34d7a33574 Add a way to change fallback stringifier
This allows reuse of projects existing stringification machinery

Closes #1024
2018-02-11 16:31:12 +01:00
Martin Hořeňovský
082c3b84bc Fix typos in documentation 2018-02-10 22:16:32 +01:00
Martin Hořeňovský
88e912b4d1 Fix documentation crosslink in configuration.md 2017-10-31 14:19:53 +01:00
Martin Hořeňovský
276393e4e5 Change ToC script to use <br> instead of trailing spaces
Also updated docs that contain ToC. Fixes #1048
2017-10-13 11:17:38 +02:00
Martin Hořeňovský
79b405fd3f Add stringification for std::chrono::{duration,time_point}
Also hides std::chrono, std::pair and std::chrono::* behind
new configuration macros, CATCH_CONFIG_ENABLE_*_STRINGMAKER
to avoid dragging in <utility>, <tuple> and <chrono> in common
path, unless requested.
2017-10-09 13:03:29 +02:00
Martin Moene
07211cea9c Add table of contents 2017-08-29 17:25:24 +02:00
Martin Moene
c5553019cc Fix heading levels
- page title (chapter): 1
- sections: 2
2017-08-29 17:25:24 +02:00
Martin Hořeňovský
053c29a2b8 Add partial implementation of CATCH_CONFIG_DISABLE
* Assertions are defined into (void)(0) no-op
* SECTIONs are defined away (leaving {} as scope)
* TEST_CASEs and TEST_CASE_METHODs are not registered.
* REGISTER_TEST_CASE is defined into (void)(0) no-op
* METHOD_AS_TEST_CASE is defined away
2017-08-27 22:05:25 +02:00
Martin Hořeňovský
2a13593885 Update CATCH_CONFIG_FAST_COMPILE documentation
Now it mentions that CHECK family of macros is affected as well
2017-08-27 16:48:15 +02:00
Martin Hořeňovský
e8d3be3621 Workaround raw string literal bug in VS2017 2017-08-27 12:38:59 +02:00
Martin Moene
071f49b12b Add page titles 2017-08-24 22:56:27 +02:00
Martin Moene
6c09b45a20 Let toplevel links to .md files link to .md#top 2017-08-24 19:40:36 +02:00
Martin Moene
e8225052f1 Add html anchor 'top' 2017-08-24 19:40:36 +02:00
Martin Hořeňovský
3dc4de8173 Document implementation of listeners in non-main files
Closes #991
2017-08-18 19:33:00 +02:00
Martin Hořeňovský
0aec06f4c3 Update documentation with changes from 7e4038d 2017-08-14 12:20:27 +01:00
Martin Hořeňovský
0ca4cfb743 Introduce compile time toggle to remove Matchers from TU
The toggle is `CATCH_CONFIG_DISABLE_MATCHERS` and the only use is
to speed up compilation of small TUs. For large ones it is likely
insignificant, because the speed up is constant relative to
number of tests/assertions in TU.
2017-07-28 21:34:34 +02:00
Phil Nash
569d355b36 Removed C++11 config macro docs 2017-04-25 14:57:47 +01:00
Martin Hořeňovský
3ae076ce8d Updated REQUIRE* documentation under FAST_COMPILE 2017-04-05 10:26:19 +02:00
Sergey Semushin
94425ad59b Add opt-in c++11 stream insertable check. (#877)
* Add opt-in c++11 stream insertable check.

To opt-in, define CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK.

Opt-in fixes #872 and should fix #757 as well.
2017-04-05 09:53:10 +02:00
Martin Hořeňovský
3a3f152979 Updated documentation of CATCH_CONFIG_FAST_COMPILE 2017-03-29 21:13:51 +02:00
Martin Hořeňovský
6a009fabcb Documented REQUIRE under CATCH_CONFIG_FAST_COMPILE 2017-03-17 17:02:39 +01:00
Martin Hořeňovský
5d8055319e Updated docs to reflect the change to leak checking 2017-02-18 17:24:31 +01:00
Martin Hořeňovský
9202a77498 Documentation improvement 2017-02-16 11:11:52 +01:00
Martin Hořeňovský
d8230a8d4d Add opt-in leak detection under MSVC + Windows.
Closes #439
2017-02-16 11:09:09 +01:00
Martin Hořeňovský
c6178601c5 Cygwin compatibility fixes 2017-02-15 17:57:22 +01:00
Martin Hořeňovský
c9a37c59c4 Added CATCH_CONFIG_FAST_COMPILE to documentation. 2017-02-15 10:42:11 +01:00
Martin Hořeňovský
e991c006b7 Fixes for MinGW compatibility
Some versions of MinGW do not support enough of Win32 API to let us work
with SEH, so SEH is now MSVC only (+ configurable toggle).

Also made use of gmtime_s MSVC only (as oposed to Windows only).

Fixes #805
2017-02-06 01:43:53 +01:00
Martin Hořeňovský
60a9ac7e65 Enabled previous commit under MSVC, introduced new feature toggle 2017-01-26 18:47:29 +01:00
Martin Hořeňovský
2e87f8e328 Merge branch 'windows-header-defines' of https://github.com/horenmar/Catch 2017-01-16 17:00:43 +01:00
Martin Hořeňovský
b3907a78e1 Added NOMINMAX and WIN32_LEAN_AND_MEAN defines before including windows.h
This stops the `windows.h` header from defining `min` and `max` macros
and including lot of Windows APIs that are not needed by Catch.
2017-01-12 16:00:02 +01:00
Martin Hořeňovský
737f4ea77c Added missing C++11 feature toggle to docs 2017-01-10 22:43:58 +01:00
Phil Nash
40d0d2f656 Added unique_ptr detection to compiler_capabilities
- as well as use by C++11 conformant compilers now enabled for VS2013 on too (see #479)
- updated docs with this (and long long and override support)
2015-08-11 08:09:41 +01:00
Phil Nash
7ab3b5aefb Added compiler feature suppression macros
_NO_ forms to disable detection of features - particularly C++11 features.
Also removed SFINAE detection (and use in tostring)
2015-06-30 08:41:55 +01:00
Phil Nash
b454c43dea Extends configuration docs 2014-12-17 18:16:24 +00:00
Phil Nash
32186db1b0 Added first cut of docs for configuring Catch
- initially just covers new colour config
- also updated all [Home] links in footers to go to local readme
2014-10-21 18:25:57 +01:00