Merge branch 'master' into master

This commit is contained in:
Martin Hořeňovský 2018-03-07 10:37:50 +01:00 committed by GitHub
commit 552589f25b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 255 additions and 150 deletions

View File

@ -17,145 +17,140 @@ matrix:
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['valgrind', 'lcov', 'clang-3.5'] packages: ['clang-3.5']
env: COMPILER='clang++-3.5' VALGRIND=1 env: COMPILER='clang++-3.5'
- os: linux - os: linux
compiler: clang compiler: clang
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['valgrind', 'lcov', 'clang-3.6'] packages: ['clang-3.6']
env: COMPILER='clang++-3.6' VALGRIND=1 env: COMPILER='clang++-3.6'
# Travis's containers do not seem to have Clang 3.7 in apt, no matter what sources I add. # Clang 3.7 is intentionally skipped as we cannot get it easily on
# - os: linux # TravisCI container
# compiler: clang
# addons:
# apt:
# sources: *all_sources
# packages: ['valgrind', 'clang-3.7']
# env: COMPILER='clang++-3.7' VALGRIND=1
- os: linux - os: linux
compiler: clang compiler: clang
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['valgrind', 'lcov', 'clang-3.8'] packages: ['lcov', 'clang-3.8']
env: COMPILER='clang++-3.8' VALGRIND=1 env: COMPILER='clang++-3.8'
- os: linux - os: linux
compiler: clang compiler: clang
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['clang-3.9', 'valgrind', 'lcov'] packages: ['clang-3.9']
env: COMPILER='clang++-3.9' VALGRIND=1 env: COMPILER='clang++-3.9'
- os: linux - os: linux
compiler: clang compiler: clang
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['clang-4.0', 'valgrind', 'lcov'] packages: ['clang-4.0']
env: COMPILER='clang++-4.0' VALGRIND=1 env: COMPILER='clang++-4.0'
- os: linux - os: linux
compiler: clang compiler: clang
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['clang-5.0', 'valgrind', 'lcov'] packages: ['clang-5.0']
env: COMPILER='clang++-5.0' VALGRIND=1 env: COMPILER='clang++-5.0'
# 2/ Linux GCC Builds # 2/ Linux GCC Builds
- os: linux - os: linux
compiler: gcc compiler: gcc
addons: addons:
apt: apt:
sources: ['ubuntu-toolchain-r-test'] sources: *all_sources
packages: ['valgrind', 'lcov', 'g++-4.8'] packages: ['g++-4.8']
env: COMPILER='g++-4.8' VALGRIND=1 env: COMPILER='g++-4.8'
- os: linux - os: linux
compiler: gcc compiler: gcc
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['valgrind', 'lcov', 'g++-4.9'] packages: ['g++-4.9']
env: COMPILER='g++-4.9' VALGRIND=1 env: COMPILER='g++-4.9'
- os: linux - os: linux
compiler: gcc compiler: gcc
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['valgrind', 'lcov', 'g++-5'] packages: ['g++-5']
env: COMPILER='g++-5' VALGRIND=1 env: COMPILER='g++-5'
- os: linux - os: linux
compiler: gcc compiler: gcc
addons: &gcc6 addons: &gcc6
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['valgrind', 'lcov', 'g++-6'] packages: ['g++-6']
env: COMPILER='g++-6' VALGRIND=1 env: COMPILER='g++-6'
- os: linux - os: linux
compiler: gcc compiler: gcc
addons: &gcc7 addons: &gcc7
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['valgrind', 'lcov', 'g++-7'] packages: ['g++-7']
env: COMPILER='g++-7' VALGRIND=1 env: COMPILER='g++-7'
# 3b/ Linux C++14 Clang builds # 3b/ Linux C++14 Clang builds
# Note that we need newer libstdc++ for C++14 support
- os: linux - os: linux
compiler: clang compiler: clang
addons: addons:
apt: apt:
packages: ['clang-3.8', 'valgrind', 'lcov', 'libstdc++-6-dev'] packages: ['clang-3.8', 'libstdc++-6-dev']
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-trusty - llvm-toolchain-trusty
env: COMPILER='clang++-3.8' CPP14=1 VALGRIND=1 env: COMPILER='clang++-3.8' CPP14=1
- os: linux - os: linux
compiler: clang compiler: clang
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['clang-3.9', 'valgrind', 'lcov', 'libstdc++-6-dev'] packages: ['clang-3.9', 'libstdc++-6-dev']
env: COMPILER='clang++-3.9' CPP14=1 VALGRIND=1 env: COMPILER='clang++-3.9' CPP14=1
- os: linux - os: linux
compiler: clang compiler: clang
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['clang-4.0', 'valgrind', 'lcov', 'libstdc++-6-dev'] packages: ['clang-4.0', 'libstdc++-6-dev']
env: COMPILER='clang++-4.0' CPP14=1 VALGRIND=1 env: COMPILER='clang++-4.0' CPP14=1
- os: linux - os: linux
compiler: clang compiler: clang
addons: addons:
apt: apt:
sources: *all_sources sources: *all_sources
packages: ['clang-5.0', 'valgrind', 'lcov', 'libstdc++-6-dev'] packages: ['clang-5.0', 'libstdc++-6-dev']
env: COMPILER='clang++-5.0' CPP14=1 VALGRIND=1 env: COMPILER='clang++-5.0' CPP14=1
# 4a/ Linux C++14 GCC builds # 4a/ Linux C++14 GCC builds
- os: linux - os: linux
compiler: gcc compiler: gcc
addons: *gcc6 addons: *gcc6
env: COMPILER='g++-6' CPP14=1 VALGRIND=1 env: COMPILER='g++-6' CPP14=1
- os: linux - os: linux
compiler: gcc compiler: gcc
addons: *gcc7 addons: *gcc7
env: COMPILER='g++-7' CPP14=1 VALGRIND=1 env: COMPILER='g++-7' CPP14=1
# 5/ OSX Clang Builds # 5/ OSX Clang Builds
- os: osx - os: osx
@ -181,8 +176,39 @@ matrix:
- os: osx - os: osx
osx_image: xcode9.1 osx_image: xcode9.1
compiler: clang compiler: clang
env: COMPILER='clang++' USE_CPP14=1 env: COMPILER='clang++' CPP14=1
# 6/ Special builds -- examples, coverage, valgrind, etc.
- os: linux
compiler: gcc
addons:
apt:
sources: *all_sources
packages: ['lcov', 'g++-7']
env: COMPILER='g++-7' CPP14=1 EXAMPLES=1 COVERAGE=1
- os: linux
compiler: clang
addons:
apt:
packages: ['clang-3.8', 'lcov']
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty
env: COMPILER='clang++-3.8' EXAMPLES=1 COVERAGE=1
- os: linux
compiler: gcc
addons:
apt:
sources: *all_sources
packages: ['valgrind', 'lcov', 'g++-7']
env: COMPILER='g++-7' CPP14=1 VALGRIND=1
- os: osx
osx_image: xcode9.1
compiler: clang
env: COMPILER='clang++' CPP14=1 EXAMPLES=1 COVERAGE=1
install: install:
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
@ -204,7 +230,7 @@ before_script:
- | - |
# Use Debug builds for running Valgrind and building examples # Use Debug builds for running Valgrind and building examples
cmake -H. -BBuild-Debug -DCMAKE_BUILD_TYPE=Debug -Wdev -DUSE_CPP14=${CPP14} -DCATCH_USE_VALGRIND=${VALGRIND} -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_COVERAGE=ON cmake -H. -BBuild-Debug -DCMAKE_BUILD_TYPE=Debug -Wdev -DUSE_CPP14=${CPP14} -DCATCH_USE_VALGRIND=${VALGRIND} -DCATCH_BUILD_EXAMPLES=${EXAMPLES} -DCATCH_ENABLE_COVERAGE=${COVERAGE}
# Don't bother with release build for coverage build # Don't bother with release build for coverage build
cmake -H. -BBuild-Release -DCMAKE_BUILD_TYPE=Release -Wdev -DUSE_CPP14=${CPP14} cmake -H. -BBuild-Release -DCMAKE_BUILD_TYPE=Release -Wdev -DUSE_CPP14=${CPP14}
@ -215,7 +241,9 @@ script:
make -j 2 make -j 2
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2 CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
# Coverage collection does not work for OS X atm # Coverage collection does not work for OS X atm
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then echo "${TRAVIS_OS_NAME}";
echo "${COVERAGE}";
if [[ "${TRAVIS_OS_NAME}" == "linux" ]] && [[ "${COVERAGE}" == "1" ]]; then
make gcov make gcov
make lcov make lcov
bash <(curl -s https://codecov.io/bash) -X gcov || echo "Codecov did not collect coverage reports" bash <(curl -s https://codecov.io/bash) -X gcov || echo "Codecov did not collect coverage reports"

View File

@ -445,9 +445,10 @@ install(EXPORT Catch2Config
# install Catch2ConfigVersion.cmake file to handle versions in find_package # install Catch2ConfigVersion.cmake file to handle versions in find_package
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
write_basic_package_version_file(Catch2ConfigVersion.cmake write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
COMPATIBILITY SameMajorVersion) COMPATIBILITY SameMajorVersion)
install(FILES install(FILES
"${CMAKE_BINARY_DIR}/Catch2ConfigVersion.cmake" "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
DESTINATION ${CATCH_CMAKE_CONFIG_DESTINATION}) DESTINATION ${CATCH_CMAKE_CONFIG_DESTINATION})

View File

@ -19,18 +19,51 @@ environment:
- additional_flags: "/D_UNICODE /DUNICODE" - additional_flags: "/D_UNICODE /DUNICODE"
wmain: 1 wmain: 1
coverage: 0
# Have a coverage dimension
- additional_flags: ""
wmain: 0
coverage: 1
# Have an examples dimension
- additional_flags: ""
wmain: 0
examples: 1
matrix: matrix:
exclude: exclude:
- os: Visual Studio 2015 - os: Visual Studio 2015
additional_flags: "/permissive- /std:c++latest" additional_flags: "/permissive- /std:c++latest"
init: - os: Visual Studio 2015
- git config --global core.autocrlf input additional_flags: "/D_UNICODE /DUNICODE"
# Exclude unwanted coverage configurations
- coverage: 1
platform: Win32
- coverage: 1
os: Visual Studio 2015
- coverage: 1
configuration: Release
# Exclude unwanted examples configurations
- examples: 1
platform: Win32
- examples: 1
os: Visual Studio 2015
- examples: 1
configuration: Release
install: install:
- ps: if (($env:CONFIGURATION) -eq "Debug" ) { python -m pip install codecov } - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { python -m pip install codecov }
- ps: if (($env:CONFIGURATION) -eq "Debug" ) { .\misc\installOpenCppCoverage.ps1 } - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { .\misc\installOpenCppCoverage.ps1 }
# Win32 and x64 are CMake-compatible solution platform names. # Win32 and x64 are CMake-compatible solution platform names.
# This allows us to pass %PLATFORM% to CMake -A. # This allows us to pass %PLATFORM% to CMake -A.

View File

@ -9,7 +9,7 @@
Most test frameworks have a large collection of assertion macros to capture all possible conditional forms (```_EQUALS```, ```_NOTEQUALS```, ```_GREATER_THAN``` etc). Most test frameworks have a large collection of assertion macros to capture all possible conditional forms (```_EQUALS```, ```_NOTEQUALS```, ```_GREATER_THAN``` etc).
Catch is different. Because it decomposes natural C-style conditional expressions most of these forms are reduced to one or two that you will use all the time. That said there are a rich set of auxilliary macros as well. We'll describe all of these here. Catch is different. Because it decomposes natural C-style conditional expressions most of these forms are reduced to one or two that you will use all the time. That said there are a rich set of auxiliary macros as well. We'll describe all of these here.
Most of these macros come in two forms: Most of these macros come in two forms:

View File

@ -78,7 +78,7 @@ Wildcards consist of the `*` character at the beginning and/or end of test case
Test specs are case insensitive. Test specs are case insensitive.
If a spec is prefixed with `exclude:` or the `~` character then the pattern matches an exclusion. This means that tests matching the pattern are excluded from the set - even if a prior inclusion spec included them. Subsequent inclusion specs will take precendence, however. If a spec is prefixed with `exclude:` or the `~` character then the pattern matches an exclusion. This means that tests matching the pattern are excluded from the set - even if a prior inclusion spec included them. Subsequent inclusion specs will take precedence, however.
Inclusions and exclusions are evaluated in left-to-right order. Inclusions and exclusions are evaluated in left-to-right order.
Test case examples: Test case examples:
@ -94,7 +94,7 @@ a* ~ab* abc Matches all tests that start with 'a', except those that
</pre> </pre>
Names within square brackets are interpreted as tags. Names within square brackets are interpreted as tags.
A series of tags form an AND expression wheras a comma-separated sequence forms an OR expression. e.g.: A series of tags form an AND expression whereas a comma-separated sequence forms an OR expression. e.g.:
<pre>[one][two],[three]</pre> <pre>[one][two],[three]</pre>
This matches all tests tagged `[one]` and `[two]`, as well as all tests tagged `[three]` This matches all tests tagged `[one]` and `[two]`, as well as all tests tagged `[three]`
@ -269,7 +269,7 @@ either before running any tests, after running all tests - or both, depending on
When running benchmarks the clock resolution is estimated. Benchmarks are then run for exponentially increasing When running benchmarks the clock resolution is estimated. Benchmarks are then run for exponentially increasing
numbers of iterations until some multiple of the estimated resolution is exceed. By default that multiple is 100, but numbers of iterations until some multiple of the estimated resolution is exceed. By default that multiple is 100, but
it can be overriden here. it can be overridden here.
<a id="usage"></a> <a id="usage"></a>
## Usage ## Usage

View File

@ -26,7 +26,7 @@ Although Catch is header only it still, internally, maintains a distinction betw
# Reporter / Listener interfaces # Reporter / Listener interfaces
CATCH_CONFIG_EXTERNAL_INTERFACES // Brings in neccessary headers for Reporter/Listener implementation CATCH_CONFIG_EXTERNAL_INTERFACES // Brings in necessary headers for Reporter/Listener implementation
Brings in various parts of Catch that are required for user defined Reporters and Listeners. This means that new Reporters and Listeners can be defined in this file as well as in the main file. Brings in various parts of Catch that are required for user defined Reporters and Listeners. This means that new Reporters and Listeners can be defined in this file as well as in the main file.
@ -79,7 +79,7 @@ This can be useful on certain platforms that do not provide the standard iostrea
By default Catch's stringification machinery falls back to a "{?}". To By default Catch's stringification machinery falls back to a "{?}". To
let projects reuse their own existing stringification machinery, this let projects reuse their own existing stringification machinery, this
fallback can be overriden by defining `CATCH_CONFIG_FALLBACK_STRINGIFIER` fallback can be overridden by defining `CATCH_CONFIG_FALLBACK_STRINGIFIER`
to a name of a function that should perform the stringification instead. to a name of a function that should perform the stringification instead.
The provided function must return std::string and must accept any type The provided function must return std::string and must accept any type

View File

@ -44,7 +44,7 @@ _Note that you should not use any assertion macros within a Listener!_
## Events that can be hooked ## Events that can be hooked
The following are the methods that can be overriden in the Listener: The following are the methods that can be overridden in the Listener:
```c++ ```c++
// The whole test run, starting and ending // The whole test run, starting and ending

View File

@ -21,7 +21,7 @@ Listing a project here does not imply endorsement and the plan is to keep these
Boost Asio style bindings for ZeroMQ Boost Asio style bindings for ZeroMQ
### [ChakraCore](https://github.com/Microsoft/ChakraCore) ### [ChakraCore](https://github.com/Microsoft/ChakraCore)
The core part of the Chakra Javascript engine that powers Microsoft Edge The core part of the Chakra JavaScript engine that powers Microsoft Edge
### [ChaiScript](https://github.com/ChaiScript/ChaiScript) ### [ChaiScript](https://github.com/ChaiScript/ChaiScript)
A, header-only, embedded scripting language designed from the ground up to directly target C++ and take advantage of modern C++ development techniques A, header-only, embedded scripting language designed from the ground up to directly target C++ and take advantage of modern C++ development techniques

View File

@ -30,7 +30,7 @@ int main( int argc, char* argv[] ) {
## Amending the config ## Amending the config
If you still want Catch to process the command line, but you want to programatically tweak the config, you can do so in one of two ways: If you still want Catch to process the command line, but you want to programmatically tweak the config, you can do so in one of two ways:
```c++ ```c++
#define CATCH_CONFIG_RUNNER #define CATCH_CONFIG_RUNNER

View File

@ -379,8 +379,8 @@ Cygwin issue with `gettimeofday` - `#define` was not early enough
* Cygwin compatibility fixes * Cygwin compatibility fixes
* Signal handling is no longer compiled by default. * Signal handling is no longer compiled by default.
* Usage of `gettimeofday` inside Catch should no longer cause compilation errors. * Usage of `gettimeofday` inside Catch should no longer cause compilation errors.
* Improved `-Wparentheses` supression for gcc (#674) * Improved `-Wparentheses` suppression for gcc (#674)
* When compiled with gcc 4.8 or newer, the supression is localized to assertions only * When compiled with gcc 4.8 or newer, the suppression is localized to assertions only
* Otherwise it is supressed for the whole TU * Otherwise it is supressed for the whole TU
* Fixed test spec parser issue (with escapes in multiple names) * Fixed test spec parser issue (with escapes in multiple names)
@ -399,7 +399,7 @@ Xml:
* C-escape control characters instead of XML encoding them (which requires XML 1.1) * C-escape control characters instead of XML encoding them (which requires XML 1.1)
* Revert XML output to XML 1.0 * Revert XML output to XML 1.0
* Can provide stylesheet references by extending the XML reporter * Can provide stylesheet references by extending the XML reporter
* Added description and tags attribites to XML Reporter * Added description and tags attributes to XML Reporter
* Tags are closed and the stream flushed more eagerly to avoid stdout interpolation * Tags are closed and the stream flushed more eagerly to avoid stdout interpolation

View File

@ -1,11 +1,11 @@
<a id="top"></a> <a id="top"></a>
# How to release # How to release
When enough changes have accumulated, it is time to release new version of Catch. This document describes the proces in doing so, that no steps are forgotten. Note that all referenced scripts can be found in the `scripts/` directory. When enough changes have accumulated, it is time to release new version of Catch. This document describes the process in doing so, that no steps are forgotten. Note that all referenced scripts can be found in the `scripts/` directory.
## Neccessary steps ## Necessary steps
These steps are neccessary and have to be performed before each new release. They serve to make sure that the new release is correct and linked-to from the standard places. These steps are necessary and have to be performed before each new release. They serve to make sure that the new release is correct and linked-to from the standard places.
### Approval testing ### Approval testing
@ -54,7 +54,7 @@ The following steps are optional, and do not have to be performed when releasing
### vcpkg update ### vcpkg update
Catch is maintaining its own port in Microsoft's package manager [vcpkg](https://github.com/Microsoft/vcpkg). This means that when new version of Catch is released, it should be posted there as well. `updateVcpkgPackage.py` can do a lot of neccessary work for you, it creates a branch and commits neccessary changes. You should review these changes, push and open a PR against vcpkg's upstream. Catch is maintaining its own port in Microsoft's package manager [vcpkg](https://github.com/Microsoft/vcpkg). This means that when new version of Catch is released, it should be posted there as well. `updateVcpkgPackage.py` can do a lot of necessary work for you, it creates a branch and commits necessary changes. You should review these changes, push and open a PR against vcpkg's upstream.
Note that the script assumes you have your fork of vcpkg checked out in a directory next to the directory where you have checked out Catch, like so: Note that the script assumes you have your fork of vcpkg checked out in a directory next to the directory where you have checked out Catch, like so:
``` ```

View File

@ -5,7 +5,7 @@
// //
// See https://github.com/philsquared/Clara for more details // See https://github.com/philsquared/Clara for more details
// Clara v1.1.2 // Clara v1.1.3
#ifndef CATCH_CLARA_HPP_INCLUDED #ifndef CATCH_CLARA_HPP_INCLUDED
#define CATCH_CLARA_HPP_INCLUDED #define CATCH_CLARA_HPP_INCLUDED
@ -18,6 +18,15 @@
#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH #define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH
#endif #endif
#ifndef CLARA_CONFIG_OPTIONAL_TYPE
#ifdef __has_include
#if __has_include(<optional>) && __cplusplus >= 201703L
#define CLARA_CONFIG_OPTIONAL_TYPE std::optional
#endif
#endif
#endif
// ----------- #included from clara_textflow.hpp ----------- // ----------- #included from clara_textflow.hpp -----------
// TextFlowCpp // TextFlowCpp
@ -389,11 +398,9 @@ namespace detail {
std::vector<std::string> m_args; std::vector<std::string> m_args;
public: public:
Args( int argc, char *argv[] ) { Args( int argc, char const* const* argv )
m_exeName = argv[0]; : m_exeName(argv[0]),
for( int i = 1; i < argc; ++i ) m_args(argv + 1, argv + argc) {}
m_args.push_back( argv[i] );
}
Args( std::initializer_list<std::string> args ) Args( std::initializer_list<std::string> args )
: m_exeName( *args.begin() ), : m_exeName( *args.begin() ),
@ -580,15 +587,13 @@ namespace detail {
protected: protected:
void enforceOk() const override { void enforceOk() const override {
// !TBD: If no exceptions, std::terminate here or something
switch( m_type ) { // Errors shouldn't reach this point, but if they do
case ResultBase::LogicError: // the actual error message will be in m_errorMessage
throw std::logic_error( m_errorMessage ); assert( m_type != ResultBase::LogicError );
case ResultBase::RuntimeError: assert( m_type != ResultBase::RuntimeError );
throw std::runtime_error( m_errorMessage ); if( m_type != ResultBase::Ok )
case ResultBase::Ok: std::abort();
break;
}
} }
std::string m_errorMessage; // Only populated if resultType is an error std::string m_errorMessage; // Only populated if resultType is an error
@ -658,6 +663,16 @@ namespace detail {
return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" ); return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" );
return ParserResult::ok( ParseResultType::Matched ); return ParserResult::ok( ParseResultType::Matched );
} }
#ifdef CLARA_CONFIG_OPTIONAL_TYPE
template<typename T>
inline auto convertInto( std::string const &source, std::optional<T>& target ) -> ParserResult {
T temp;
auto result = convertInto( source, temp );
if( result )
target = temp;
return result;
}
#endif // CLARA_CONFIG_OPTIONAL_TYPE
struct NonCopyable { struct NonCopyable {
NonCopyable() = default; NonCopyable() = default;

View File

@ -13,7 +13,7 @@ namespace Catch {
using StringMatcher = Matchers::Impl::MatcherBase<std::string>; using StringMatcher = Matchers::Impl::MatcherBase<std::string>;
// This is the general overload that takes a any string matcher // This is the general overload that takes a any string matcher
// There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers
// the Equals matcher (so the header does not mention matchers) // the Equals matcher (so the header does not mention matchers)
void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) { void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) {
std::string exceptionMessage = Catch::translateActiveException(); std::string exceptionMessage = Catch::translateActiveException();

View File

@ -68,11 +68,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// We know some environments not to support full POSIX signals // We know some environments not to support full POSIX signals
#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) #if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__)
#define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
# if !defined(CATCH_CONFIG_POSIX_SIGNALS)
# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
# endif
#endif #endif
#ifdef __OS400__ #ifdef __OS400__

View File

@ -57,7 +57,7 @@ namespace Catch {
m_context(getCurrentMutableContext()), m_context(getCurrentMutableContext()),
m_config(_config), m_config(_config),
m_reporter(std::move(reporter)), m_reporter(std::move(reporter)),
m_lastAssertionInfo{ "", SourceLineInfo("",0), "", ResultDisposition::Normal }, m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal },
m_includeSuccessfulResults( m_config->includeSuccessfulResults() ) m_includeSuccessfulResults( m_config->includeSuccessfulResults() )
{ {
m_context.setRunner(this); m_context.setRunner(this);
@ -84,7 +84,7 @@ namespace Catch {
std::string redirectedCout; std::string redirectedCout;
std::string redirectedCerr; std::string redirectedCerr;
TestCaseInfo testInfo = testCase.getTestCaseInfo(); auto const& testInfo = testCase.getTestCaseInfo();
m_reporter->testCaseStarting(testInfo); m_reporter->testCaseStarting(testInfo);
@ -292,7 +292,7 @@ namespace Catch {
Counts prevAssertions = m_totals.assertions; Counts prevAssertions = m_totals.assertions;
double duration = 0; double duration = 0;
m_shouldReportUnexpected = true; m_shouldReportUnexpected = true;
m_lastAssertionInfo = { "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal }; m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal };
seedRng(*m_config); seedRng(*m_config);

View File

@ -133,7 +133,7 @@ namespace Catch {
if ( !exceptions.empty() ) { if ( !exceptions.empty() ) {
m_startupExceptions = true; m_startupExceptions = true;
Colour colourGuard( Colour::Red ); Colour colourGuard( Colour::Red );
Catch::cerr() << "Errors occured during startup!" << '\n'; Catch::cerr() << "Errors occurred during startup!" << '\n';
// iterate over all exceptions and notify user // iterate over all exceptions and notify user
for ( const auto& ex_ptr : exceptions ) { for ( const auto& ex_ptr : exceptions ) {
try { try {
@ -165,7 +165,7 @@ namespace Catch {
<< std::left << std::setw(16) << "version: " << libraryVersion() << std::endl; << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl;
} }
int Session::applyCommandLine( int argc, char* argv[] ) { int Session::applyCommandLine( int argc, char const * const * argv ) {
if( m_startupExceptions ) if( m_startupExceptions )
return 1; return 1;

View File

@ -25,7 +25,7 @@ namespace Catch {
void showHelp() const; void showHelp() const;
void libIdentify(); void libIdentify();
int applyCommandLine( int argc, char* argv[] ); int applyCommandLine( int argc, char const * const * argv );
void useConfigData( ConfigData const& configData ); void useConfigData( ConfigData const& configData );

View File

@ -48,8 +48,7 @@ namespace Catch {
TestCase makeTestCase( ITestInvoker* _testCase, TestCase makeTestCase( ITestInvoker* _testCase,
std::string const& _className, std::string const& _className,
std::string const& _name, NameAndTags const& nameAndTags,
std::string const& _descOrTags,
SourceLineInfo const& _lineInfo ) SourceLineInfo const& _lineInfo )
{ {
bool isHidden = false; bool isHidden = false;
@ -58,6 +57,7 @@ namespace Catch {
std::vector<std::string> tags; std::vector<std::string> tags;
std::string desc, tag; std::string desc, tag;
bool inTag = false; bool inTag = false;
std::string _descOrTags = nameAndTags.tags;
for (char c : _descOrTags) { for (char c : _descOrTags) {
if( !inTag ) { if( !inTag ) {
if( c == '[' ) if( c == '[' )
@ -85,8 +85,8 @@ namespace Catch {
tags.push_back( "." ); tags.push_back( "." );
} }
TestCaseInfo info( _name, _className, desc, tags, _lineInfo ); TestCaseInfo info( nameAndTags.name, _className, desc, tags, _lineInfo );
return TestCase( _testCase, info ); return TestCase( _testCase, std::move(info) );
} }
void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) { void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {
@ -147,7 +147,7 @@ namespace Catch {
} }
TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo const& info ) : TestCaseInfo( info ), test( testCase ) {} TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {}
TestCase TestCase::withName( std::string const& _newName ) const { TestCase TestCase::withName( std::string const& _newName ) const {

View File

@ -9,6 +9,7 @@
#define TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED #define TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
#include "catch_common.h" #include "catch_common.h"
#include "catch_test_registry.h"
#include <string> #include <string>
#include <vector> #include <vector>
@ -61,7 +62,7 @@ namespace Catch {
class TestCase : public TestCaseInfo { class TestCase : public TestCaseInfo {
public: public:
TestCase( ITestInvoker* testCase, TestCaseInfo const& info ); TestCase( ITestInvoker* testCase, TestCaseInfo&& info );
TestCase withName( std::string const& _newName ) const; TestCase withName( std::string const& _newName ) const;
@ -78,8 +79,7 @@ namespace Catch {
TestCase makeTestCase( ITestInvoker* testCase, TestCase makeTestCase( ITestInvoker* testCase,
std::string const& className, std::string const& className,
std::string const& name, NameAndTags const& nameAndTags,
std::string const& description,
SourceLineInfo const& lineInfo ); SourceLineInfo const& lineInfo );
} }

View File

@ -96,7 +96,7 @@ namespace Catch {
m_testAsFunction(); m_testAsFunction();
} }
std::string extractClassName( std::string const& classOrQualifiedMethodName ) { std::string extractClassName( StringRef const& classOrQualifiedMethodName ) {
std::string className = classOrQualifiedMethodName; std::string className = classOrQualifiedMethodName;
if( startsWith( className, '&' ) ) if( startsWith( className, '&' ) )
{ {

View File

@ -22,7 +22,7 @@ namespace Catch {
class TestCase; class TestCase;
struct IConfig; struct IConfig;
std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ); std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases );
bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ); void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions );
@ -58,7 +58,7 @@ namespace Catch {
}; };
std::string extractClassName( std::string const& classOrQualifiedMethodName ); std::string extractClassName( StringRef const& classOrQualifiedMethodName );
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

View File

@ -15,23 +15,22 @@ namespace Catch {
return new(std::nothrow) TestInvokerAsFunction( testAsFunction ); return new(std::nothrow) TestInvokerAsFunction( testAsFunction );
} }
NameAndTags::NameAndTags( StringRef name_ , StringRef tags_ ) noexcept : name( name_ ), tags( tags_ ) {} NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {}
AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept { AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept {
try { try {
getMutableRegistryHub() getMutableRegistryHub()
.registerTest( .registerTest(
makeTestCase( makeTestCase(
invoker, invoker,
extractClassName( classOrMethod ), extractClassName( classOrMethod ),
nameAndTags.name, nameAndTags,
nameAndTags.tags,
lineInfo)); lineInfo));
} catch (...) { } catch (...) {
// Do not throw when constructing global objects, instead register the exception to be processed later // Do not throw when constructing global objects, instead register the exception to be processed later
getMutableRegistryHub().registerStartupException(); getMutableRegistryHub().registerStartupException();
} }
} }
AutoReg::~AutoReg() = default; AutoReg::~AutoReg() = default;
} }

View File

@ -35,13 +35,13 @@ auto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* {
} }
struct NameAndTags { struct NameAndTags {
NameAndTags( StringRef name_ = StringRef(), StringRef tags_ = StringRef() ) noexcept; NameAndTags( StringRef const& name_ = StringRef(), StringRef const& tags_ = StringRef() ) noexcept;
StringRef name; StringRef name;
StringRef tags; StringRef tags;
}; };
struct AutoReg : NonCopyable { struct AutoReg : NonCopyable {
AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept; AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept;
~AutoReg(); ~AutoReg();
}; };

View File

@ -26,7 +26,7 @@ namespace Catch {
~TAPReporter() override; ~TAPReporter() override;
static std::string getDescription() { static std::string getDescription() {
return "Reports test results in TAP format, suitable for test harneses"; return "Reports test results in TAP format, suitable for test harnesses";
} }
ReporterPreferences getPreferences() const override { ReporterPreferences getPreferences() const override {

View File

@ -1,12 +1,26 @@
@REM # In debug build, we want to
@REM # 1) Prebuild memcheck redirecter @REM # Possibilities:
@REM # 2) Regenerate single header include for examples @REM # Debug build + coverage
@REM # 3) Enable building examples @REM # Debug build + examples
@REM # Debug build + ---
@REM # Release build
if "%CONFIGURATION%"=="Debug" ( if "%CONFIGURATION%"=="Debug" (
python scripts\generateSingleHeader.py if "%coverage%"=="1" (
cmake -Hmisc -Bbuild-misc -A%PLATFORM% @REM # coverage needs to build the special helper as well as the main
cmake --build build-misc cmake -Hmisc -Bbuild-misc -A%PLATFORM%
cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DCATCH_BUILD_EXAMPLES=ON -DMEMORYCHECK_COMMAND=build-misc\Debug\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind cmake --build build-misc
cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DMEMORYCHECK_COMMAND=build-misc\Debug\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind
) else (
@REM # We know that coverage is 0
if "%examples%"=="1" (
@REM # Examples live off the single header, so it needs to be regenerated
python scripts\generateSingleHeader.py
cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DCATCH_BUILD_EXAMPLES=ON
) else (
@REM # This is just a plain debug build
cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain%
)
)
) )
if "%CONFIGURATION%"=="Release" ( if "%CONFIGURATION%"=="Release" (
cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain%

View File

@ -1,8 +1,12 @@
cd Build cd Build
if "%CONFIGURATION%"=="Debug" ( if "%CONFIGURATION%"=="Debug" (
ctest -j 2 -C %CONFIGURATION% -D ExperimentalMemCheck if "%coverage%"=="1" (
python ..\misc\appveyorMergeCoverageScript.py ctest -j 2 -C %CONFIGURATION% -D ExperimentalMemCheck
codecov --root .. --no-color --disable gcov -f cobertura.xml -t %CODECOV_TOKEN% python ..\misc\appveyorMergeCoverageScript.py
codecov --root .. --no-color --disable gcov -f cobertura.xml -t %CODECOV_TOKEN%
) else (
ctest -j 2 -C %CONFIGURATION%
)
) )
if "%CONFIGURATION%"=="Release" ( if "%CONFIGURATION%"=="Release" (
ctest -j 2 -C %CONFIGURATION% ctest -j 2 -C %CONFIGURATION%

View File

@ -1,5 +1,5 @@
# Downloads are done from the oficial github release page links # Downloads are done from the official github release page links
$downloadUrl = "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.6.1/OpenCppCoverageSetup-x64-0.9.6.1.exe" $downloadUrl = "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.7.0/OpenCppCoverageSetup-x64-0.9.7.0.exe"
$installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Downloads", "OpenCppCoverageSetup.exe") $installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Downloads", "OpenCppCoverageSetup.exe")
if(-Not (Test-Path $installerPath)) { if(-Not (Test-Path $installerPath)) {

View File

@ -53,7 +53,7 @@
:test-result: PASS Inequality checks that should succeed :test-result: PASS Inequality checks that should succeed
:test-result: PASS Less-than inequalities with different epsilons :test-result: PASS Less-than inequalities with different epsilons
:test-result: PASS Long strings can be wrapped :test-result: PASS Long strings can be wrapped
:test-result: PASS Long text is truncted :test-result: PASS Long text is truncated
:test-result: PASS ManuallyRegistered :test-result: PASS ManuallyRegistered
:test-result: PASS Matchers can be (AllOf) composed with the && operator :test-result: PASS Matchers can be (AllOf) composed with the && operator
:test-result: PASS Matchers can be (AnyOf) composed with the || operator :test-result: PASS Matchers can be (AnyOf) composed with the || operator

View File

@ -15,7 +15,7 @@
# pragma clang diagnostic ignored "-Wc++98-compat" # pragma clang diagnostic ignored "-Wc++98-compat"
#endif #endif
inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( nullptr, "", name, desc, CATCH_INTERNAL_LINEINFO ); } inline Catch::TestCase fakeTestCase(const char* name, const char* desc = "") { return Catch::makeTestCase(nullptr, "", { name, desc }, CATCH_INTERNAL_LINEINFO); }
TEST_CASE( "Parse test names and tags" ) { TEST_CASE( "Parse test names and tags" ) {

View File

@ -12,7 +12,7 @@
#include <stdexcept> #include <stdexcept>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable:4702) // Unreachable code -- uncoditional throws and so on #pragma warning(disable:4702) // Unreachable code -- unconditional throws and so on
#endif #endif
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic push #pragma clang diagnostic push

View File

@ -2,7 +2,7 @@
#include <vector> #include <vector>
#include <array> #include <array>
// vedctor // vector
TEST_CASE( "vector<int> -> toString", "[toString][vector]" ) TEST_CASE( "vector<int> -> toString", "[toString][vector]" )
{ {
std::vector<int> vv; std::vector<int> vv;

View File

@ -61,9 +61,9 @@ FILE_2 description
.\" .Sh DIAGNOSTICS \" May not be needed .\" .Sh DIAGNOSTICS \" May not be needed
.\" .Bl -diag .\" .Bl -diag
.\" .It Diagnostic Tag .\" .It Diagnostic Tag
.\" Diagnostic informtion here. .\" Diagnostic information here.
.\" .It Diagnostic Tag .\" .It Diagnostic Tag
.\" Diagnostic informtion here. .\" Diagnostic information here.
.\" .El .\" .El
.Sh SEE ALSO .Sh SEE ALSO
.\" List links in ascending order by section, alphabetically within a section. .\" List links in ascending order by section, alphabetically within a section.

View File

@ -127,7 +127,7 @@ def tagAndCollect(lines, id_tag=True, back_links=False, exclude_h=None):
A list of 3-value sublists, where the first value A list of 3-value sublists, where the first value
represents the heading, the second value the string represents the heading, the second value the string
that was inserted assigned to the IDs in the anchor tags, that was inserted assigned to the IDs in the anchor tags,
and the third value is an integer that reprents the headline level. and the third value is an integer that represents the headline level.
E.g., E.g.,
[['some header lvl3', 'some-header-lvl3', 3], ...] [['some header lvl3', 'some-header-lvl3', 3], ...]
@ -282,7 +282,7 @@ def markdownToclify(
input_file: str input_file: str
Path to the markdown input file. Path to the markdown input file.
output_file: str (defaul: None) output_file: str (default: None)
Path to the markdown output file. Path to the markdown output file.
min_toc_len: int (default: 2) min_toc_len: int (default: 2)
@ -420,7 +420,7 @@ def updateDocumentToCMain():
default=minTocEntries, default=minTocEntries,
type=int, type=int,
metavar='N', metavar='N',
help='the minimum number of entries to create a table of contents for [{deflt}]'.format(deflt=minTocEntries)) help='the minimum number of entries to create a table of contents for [{default}]'.format(default=minTocEntries))
parser.add_argument( parser.add_argument(
'--remove-toc', '--remove-toc',

View File

@ -89,7 +89,7 @@ def git_push(path_to_repo):
# Make sure we branch off master # Make sure we branch off master
subprocess.call('git checkout master', shell=True) subprocess.call('git checkout master', shell=True)
# Update repo to current master, so we don't work off old version of the portsfile # Update repo to current master, so we don't work off old version of the portfile
subprocess.call('git pull Microsoft master', shell=True) subprocess.call('git pull Microsoft master', shell=True)
subprocess.call('git push', shell=True) subprocess.call('git push', shell=True)

45
third_party/clara.hpp vendored
View File

@ -5,7 +5,7 @@
// //
// See https://github.com/philsquared/Clara for more details // See https://github.com/philsquared/Clara for more details
// Clara v1.1.2 // Clara v1.1.3
#ifndef CLARA_HPP_INCLUDED #ifndef CLARA_HPP_INCLUDED
#define CLARA_HPP_INCLUDED #define CLARA_HPP_INCLUDED
@ -18,6 +18,15 @@
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CLARA_CONFIG_CONSOLE_WIDTH #define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CLARA_CONFIG_CONSOLE_WIDTH
#endif #endif
#ifndef CLARA_CONFIG_OPTIONAL_TYPE
#ifdef __has_include
#if __has_include(<optional>) && __cplusplus >= 201703L
#define CLARA_CONFIG_OPTIONAL_TYPE std::optional
#endif
#endif
#endif
// ----------- #included from clara_textflow.hpp ----------- // ----------- #included from clara_textflow.hpp -----------
// TextFlowCpp // TextFlowCpp
@ -389,11 +398,9 @@ namespace detail {
std::vector<std::string> m_args; std::vector<std::string> m_args;
public: public:
Args( int argc, char *argv[] ) { Args( int argc, char const* const* argv )
m_exeName = argv[0]; : m_exeName(argv[0]),
for( int i = 1; i < argc; ++i ) m_args(argv + 1, argv + argc) {}
m_args.push_back( argv[i] );
}
Args( std::initializer_list<std::string> args ) Args( std::initializer_list<std::string> args )
: m_exeName( *args.begin() ), : m_exeName( *args.begin() ),
@ -580,15 +587,13 @@ namespace detail {
protected: protected:
void enforceOk() const override { void enforceOk() const override {
// !TBD: If no exceptions, std::terminate here or something
switch( m_type ) { // Errors shouldn't reach this point, but if they do
case ResultBase::LogicError: // the actual error message will be in m_errorMessage
throw std::logic_error( m_errorMessage ); assert( m_type != ResultBase::LogicError );
case ResultBase::RuntimeError: assert( m_type != ResultBase::RuntimeError );
throw std::runtime_error( m_errorMessage ); if( m_type != ResultBase::Ok )
case ResultBase::Ok: std::abort();
break;
}
} }
std::string m_errorMessage; // Only populated if resultType is an error std::string m_errorMessage; // Only populated if resultType is an error
@ -658,6 +663,16 @@ namespace detail {
return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" ); return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" );
return ParserResult::ok( ParseResultType::Matched ); return ParserResult::ok( ParseResultType::Matched );
} }
#ifdef CLARA_CONFIG_OPTIONAL_TYPE
template<typename T>
inline auto convertInto( std::string const &source, std::optional<T>& target ) -> ParserResult {
T temp;
auto result = convertInto( source, temp );
if( result )
target = temp;
return result;
}
#endif // CLARA_CONFIG_OPTIONAL_TYPE
struct NonCopyable { struct NonCopyable {
NonCopyable() = default; NonCopyable() = default;