diff options
author | Didier Raboud <odyx@debian.org> | 2019-12-23 17:59:26 +0100 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2019-12-23 17:59:26 +0100 |
commit | ecfdf7d8373f29c66ad021428a366efea366cbc7 (patch) | |
tree | 786362c115d10621fc924254b83663169eb8069b | |
parent | 8f22ddc066df6a8cc8832ab2e3a34b8a46791196 (diff) | |
parent | 393d39bd1609e7e67522be0fb926d30b58be0f3c (diff) |
Merge tag 'upstream/2.3.6+repack0' into debian/master
-rw-r--r-- | .editorconfig | 12 | ||||
-rw-r--r-- | .github/workflows/main.yml | 508 | ||||
-rw-r--r-- | .github/workflows/vsenv.bat | 17 | ||||
-rw-r--r-- | .travis.yml | 19 | ||||
-rw-r--r-- | CHANGELOG.md | 27 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | doc/markdown/faq.md | 2 | ||||
-rw-r--r-- | doctest/doctest.h | 43 | ||||
-rw-r--r-- | doctest/parts/doctest.cpp | 26 | ||||
-rw-r--r-- | doctest/parts/doctest_fwd.h | 17 | ||||
-rw-r--r-- | examples/all_features/test_output/list_test_cases_xml.txt | 8 | ||||
-rw-r--r-- | examples/all_features/test_output/version.txt | 2 | ||||
-rw-r--r-- | examples/all_features/test_output/version_xml.txt | 2 | ||||
-rw-r--r-- | examples/executable_dll_and_plugin/main.cpp | 2 | ||||
-rw-r--r-- | examples/executable_dll_and_plugin/plugin.cpp | 12 | ||||
-rw-r--r-- | examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin.txt | 21 | ||||
-rw-r--r-- | examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin_xml.txt | 40 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | scripts/cmake/common.cmake | 9 | ||||
-rw-r--r-- | scripts/cmake/exec_test.cmake | 6 | ||||
-rw-r--r-- | scripts/version.txt | 2 |
21 files changed, 701 insertions, 78 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bdc3756 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +trim_trailing_whitespace = true +end_of_line = lf +indent_style = space +indent_size = 4 +insert_final_newline = true + +[*.yml] +indent_size = 2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3e1855c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,508 @@ +name: CI + +on: push + +jobs: + ci: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + + env: + CMAKE_GENERATOR: Ninja + ASAN_OPTIONS: strict_string_checks=true:detect_odr_violation=2:detect_stack_use_after_return=true:check_initialization_order=true:strict_init_order=true + TSAN_OPTIONS: force_seq_cst_atomics=1 + CTEST_OUTPUT_ON_FAILURE: ON + CTEST_PARALLEL_LEVEL: 2 + + strategy: + fail-fast: false + matrix: + # Github Actions requires a single row to be added to the build matrix. + # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. + name: [ + ubuntu-18.04-gcc-4.8, + ubuntu-18.04-gcc-4.9, + ubuntu-18.04-gcc-5, + ubuntu-18.04-gcc-6, + ubuntu-18.04-gcc-7, + ubuntu-18.04-gcc-8, + ubuntu-18.04-gcc-9, + ubuntu-18.04-clang-3.5, + ubuntu-18.04-clang-3.6, + ubuntu-18.04-clang-3.7, + ubuntu-18.04-clang-3.8, + ubuntu-18.04-clang-3.9, + ubuntu-18.04-clang-4.0, + ubuntu-18.04-clang-5.0, + ubuntu-18.04-clang-6.0, + ubuntu-18.04-clang-7, + ubuntu-18.04-clang-8, + ubuntu-18.04-clang-9, + windows-2016-cl, + windows-2016-clang-cl, + windows-2016-clang, + windows-2016-gcc, + windows-2019-cl, + windows-2019-clang-cl, + windows-2019-clang, + windows-2019-gcc, + macOS-10.14-xcode-9.4.1, + macOS-10.14-xcode-10.0, + macOS-10.14-xcode-10.1, + macOS-10.14-xcode-10.2, + macOS-10.14-xcode-10.2.1, + macOS-10.14-xcode-10.3, + macOS-10.14-xcode-11.0, + macOS-10.14-gcc-7, + macOS-10.14-gcc-8, + macOS-10.14-gcc-9, + ] + + include: + - name: ubuntu-18.04-gcc-4.8 + os: ubuntu-18.04 + compiler: gcc + version: "4.8" + + - name: ubuntu-18.04-gcc-4.9 + os: ubuntu-18.04 + compiler: gcc + version: "4.9" + + - name: ubuntu-18.04-gcc-5 + os: ubuntu-18.04 + compiler: gcc + version: "5" + + - name: ubuntu-18.04-gcc-6 + os: ubuntu-18.04 + compiler: gcc + version: "6" + + - name: ubuntu-18.04-gcc-7 + os: ubuntu-18.04 + compiler: gcc + version: "7" + + - name: ubuntu-18.04-gcc-8 + os: ubuntu-18.04 + compiler: gcc + version: "8" + + - name: ubuntu-18.04-gcc-9 + os: ubuntu-18.04 + compiler: gcc + version: "9" + + - name: ubuntu-18.04-clang-3.5 + os: ubuntu-18.04 + compiler: clang + version: "3.5" + + - name: ubuntu-18.04-clang-3.6 + os: ubuntu-18.04 + compiler: clang + version: "3.6" + + - name: ubuntu-18.04-clang-3.7 + os: ubuntu-18.04 + compiler: clang + version: "3.7" + + - name: ubuntu-18.04-clang-3.8 + os: ubuntu-18.04 + compiler: clang + version: "3.8" + + - name: ubuntu-18.04-clang-3.9 + os: ubuntu-18.04 + compiler: clang + version: "3.9" + + - name: ubuntu-18.04-clang-4.0 + os: ubuntu-18.04 + compiler: clang + version: "4.0" + + - name: ubuntu-18.04-clang-5.0 + os: ubuntu-18.04 + compiler: clang + version: "5.0" + + - name: ubuntu-18.04-clang-6.0 + os: ubuntu-18.04 + compiler: clang + version: "6.0" + + - name: ubuntu-18.04-clang-7 + os: ubuntu-18.04 + compiler: clang + version: "7" + + - name: ubuntu-18.04-clang-8 + os: ubuntu-18.04 + compiler: clang + version: "8" + + - name: ubuntu-18.04-clang-9 + os: ubuntu-18.04 + compiler: clang + version: "9" + + - name: windows-2016-cl + os: windows-2016 + compiler: cl + + - name: windows-2016-clang-cl + os: windows-2016 + compiler: clang-cl + + - name: windows-2016-clang + os: windows-2016 + compiler: clang + + - name: windows-2019-cl + os: windows-2019 + compiler: cl + + - name: windows-2016-gcc + os: windows-2016 + compiler: gcc + + - name: windows-2019-clang-cl + os: windows-2019 + compiler: clang-cl + + - name: windows-2019-clang + os: windows-2019 + compiler: clang + + - name: windows-2019-gcc + os: windows-2019 + compiler: gcc + + - name: macOS-10.14-xcode-9.4.1 + os: macOS-10.14 + compiler: xcode + version: "9.4.1" + + - name: macOS-10.14-xcode-10.0 + os: macOS-10.14 + compiler: xcode + version: "10" + + - name: macOS-10.14-xcode-10.1 + os: macOS-10.14 + compiler: xcode + version: "10.1" + + - name: macOS-10.14-Xcode-10.2 + os: macOS-10.14 + compiler: xcode + version: "10.2" + + - name: macOS-10.14-xcode-10.2.1 + os: macOS-10.14 + compiler: xcode + version: "10.2.1" + + - name: macOS-10.14-xcode-10.3 + os: macOS-10.14 + compiler: xcode + version: "10.3" + + - name: macOS-10.14-xcode-11.0 + os: macOS-10.14 + compiler: xcode + version: "11" + + - name: macOS-10.14-gcc-7 + os: macOS-10.14 + compiler: gcc + version: "7" + + - name: macOS-10.14-gcc-8 + os: macOS-10.14 + compiler: gcc + version: "8" + + - name: macOS-10.14-gcc-9 + os: macOS-10.14 + compiler: gcc + version: "9" + + steps: + - uses: actions/checkout@v1 + + - name: Install (Linux) + if: runner.os == 'Linux' + run: | + # CMake 3.15 allows specifying the generator using the CMAKE_GENERATOR + # environment variable. + curl -sSL https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4-Linux-x86_64.tar.gz -o cmake.tar.gz + sudo tar xf cmake.tar.gz --strip 1 -C /usr/local + + # Required for libc6-dbg:i386 and g++-multilib packages which are + # needed for x86 builds. + sudo dpkg --add-architecture i386 + + # clang-3.7 and earlier are not available in Bionic anymore so we get + # them from the Xenial repositories instead. + sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main" + sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe" + + # LLVM 9 is not in Bionic's repositories so we add the official LLVM repository. + if [ "${{ matrix.compiler }}" = "clang" ] && [ "${{ matrix.version }}" = "9" ]; then + sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" + fi + + sudo apt-get update + + # libc6-dbg:i386 is required for running valgrind on x86. + sudo apt-get install -y ninja-build valgrind libc6-dbg:i386 + + if [ "${{ matrix.compiler }}" = "gcc" ]; then + sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib + echo "::set-env name=CC::gcc-${{ matrix.version }}" + echo "::set-env name=CXX::g++-${{ matrix.version }}" + else + sudo apt-get install -y clang-${{ matrix.version }} g++-multilib + echo "::set-env name=CC::clang-${{ matrix.version }}" + echo "::set-env name=CXX::clang++-${{ matrix.version }}" + fi + + - name: Install (macOS) + if: runner.os == 'macOS' + run: | + brew install cmake ninja + + if [ "${{ matrix.compiler }}" = "gcc" ]; then + brew install gcc@${{ matrix.version }} + echo "::set-env name=CC::gcc-${{ matrix.version }}" + echo "::set-env name=CXX::g++-${{ matrix.version }}" + else + sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app + echo "::set-env name=CC::clang" + echo "::set-env name=CXX::clang++" + fi + + - name: Install (Windows) + if: runner.os == 'Windows' + shell: powershell + run: | + Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') + scoop install ninja --global + + if ("${{ matrix.compiler }}".StartsWith("clang")) { + scoop install llvm --global + } + + if ("${{ matrix.compiler }}" -eq "gcc") { + # Chocolatey GCC is broken on the windows-2019 image. + # See: https://github.com/DaanDeMeyer/doctest/runs/231595515 + # See: https://github.community/t5/GitHub-Actions/Something-is-wrong-with-the-chocolatey-installed-version-of-gcc/td-p/32413 + scoop install gcc --global + echo "::set-env name=CC::gcc" + echo "::set-env name=CXX::g++" + } elseif ("${{ matrix.compiler }}" -eq "clang") { + echo "::set-env name=CC::clang" + echo "::set-env name=CXX::clang++" + } else { + echo "::set-env name=CC::${{ matrix.compiler }}" + echo "::set-env name=CXX::${{ matrix.compiler }}" + } + + # Scoop modifies the PATH so we make the modified PATH global. + echo "::set-env name=PATH::$env:PATH" + + - name: Configure ASAN/UBSAN + if: runner.os == 'Linux' || runner.os == 'macOS' + run: | + # https://stackoverflow.com/a/37939589/11900641 + function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } + + # Disable sanitizers in configurations where we know they are buggy. + + # TODO: Move these conditions to the if clause if Github Actions ever + # adds support for comparing versions. + # See: https://github.community/t5/GitHub-Actions/Allow-comparing-versions-in-if-conditions/m-p/33912#M1710 + + if [ "${{ runner.os }}" = "Linux" ] && \ + [ "${{ matrix.compiler }}" = "gcc" ] && \ + [ $(version ${{ matrix.version }}) -le $(version "5.0") ]; then + exit 0 + fi + + if [ "${{ runner.os }}" = "Linux" ] && \ + [ "${{ matrix.compiler }}" = "clang" ] && \ + [ $(version ${{ matrix.version }}) -le $(version "6.0") ]; then + exit 0 + fi + + if [ "${{ runner.os }}" = "macOS" ] && \ + [ "${{ matrix.compiler }}" = "xcode" ] && \ + [ $(version ${{ matrix.version }}) -le $(version "9.4.1") ]; then + exit 0 + fi + + if [ "${{ runner.os }}" = "macOS" ] && \ + [ "${{ matrix.compiler }}" = "gcc" ]; then + exit 0 + fi + + ASAN_UBSAN_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" + + # Link statically against ASAN libraries because dynamically linking + # against ASAN libraries causes problems when using dlopen on Ubuntu. + # See: https://github.com/DaanDeMeyer/doctest/runs/249002713 + if [ "${{ runner.os }}" = "Linux" ] && [ "${{ matrix.compiler }}" = "gcc" ]; then + ASAN_UBSAN_FLAGS="$ASAN_UBSAN_FLAGS -static-libasan" + fi + + # Compiling in bash on Windows doesn't work and powershell doesn't + # exit on non-zero exit codes so we're forced to use cmd which means + # we don't have a cross platform way to access environment variables. + # To circumvent this, we put the sanitizer flags in an environment + # variable that is automatically picked up by CMake. + echo "::set-env name=CXXFLAGS::$ASAN_UBSAN_FLAGS" + + - name: Configure TSAN + if: runner.os == 'Linux' || runner.os == 'macOS' + run: | + # https://stackoverflow.com/a/37939589/11900641 + function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } + + if [ "${{ runner.os }}" = "Linux" ] && \ + [ "${{ matrix.compiler }}" = "gcc" ] && \ + [ $(version ${{ matrix.version }}) -le $(version "6.0") ]; then + exit 0 + fi + + if [ "${{ runner.os }}" = "Linux" ] && \ + [ "${{ matrix.compiler }}" = "clang" ] && \ + [ $(version ${{ matrix.version }}) -le $(version "3.9") ]; then + exit 0 + fi + + if [ "${{ runner.os }}" = "macOS" ] && \ + [ "${{ matrix.compiler }}" = "gcc" ]; then + exit 0 + fi + + TSAN_FLAGS="-fsanitize=thread -pie -fPIE" + + if [ "${{ runner.os }}" = "Linux" ] && [ "${{ matrix.compiler }}" = "gcc" ]; then + TSAN_FLAGS="$TSAN_FLAGS -static-libtsan" + fi + + # The thread sanitizers build does not run on Windows so we can just + # use bash syntax to access the TSAN flags in the thread sanitizers + # build step. + echo "::set-env name=TSAN_FLAGS::$TSAN_FLAGS" + + - name: Configure x64 + if: runner.os == 'Windows' + run: .github\workflows\vsenv.bat -arch=x64 -host_arch=x64 + + - name: Build & Test Debug x64 + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DDOCTEST_TEST_MODE=COMPARE + cmake --build build + cd build && ctest + + - name: Build & Test Release x64 + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DDOCTEST_TEST_MODE=COMPARE + cmake --build build + cd build && ctest + + # Valgrind doesn't support the latest macOS versions. + # `-DCMAKE_CXX_FLAGS=""` overrides CXXFLAGS (disables sanitizers). + + - name: Build & Test Debug x64 Valgrind + if: runner.os == 'Linux' + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="" -DDOCTEST_TEST_MODE=VALGRIND + cmake --build build + cd build && ctest + + - name: Build & Test Release x64 Valgrind + if: runner.os == 'Linux' + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="" -DDOCTEST_TEST_MODE=VALGRIND + cmake --build build + cd build && ctest + + - name: Build & Test Debug x64 Thread Sanitizers + if: runner.os == 'Linux' || runner.os == 'macOS' + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="$TSAN_FLAGS" -DDOCTEST_TEST_MODE=COMPARE + cmake --build build + cd build && ctest + + - name: Build & Test Debug x64 without RTTI + if: runner.os == 'Linux' || runner.os == 'macOS' + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fno-rtti" -DDOCTEST_TEST_MODE=COMPARE + cmake --build build + cd build && ctest + + - name: Build x64 Debug without exceptions + if: runner.os == 'Linux' || runner.os == 'macOS' + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fno-exceptions -DDOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS" + cmake --build build + + # MinGW x86 tests fail on Windows: https://github.com/DaanDeMeyer/doctest/runs/240600881. + # MacOS doesn't support x86 from Xcode 10 onwards. + + - name: Configure x86 + shell: pwsh + if: (runner.os == 'Windows' && matrix.compiler != 'gcc') || runner.os == 'Linux' + run: | + if ("${{ runner.os }}" -eq "Windows") { + & .github\workflows\vsenv.bat -arch=x86 -host_arch=x64 + } + + if ("${{ matrix.compiler }}" -notcontains "cl") { + echo "::set-env name=CXXFLAGS::$env:CXXFLAGS -m32" + } + + - name: Build & Test Debug x86 + if: (runner.os == 'Windows' && matrix.compiler != 'gcc') || runner.os == 'Linux' + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DDOCTEST_TEST_MODE=COMPARE + cmake --build build + cd build && ctest + + - name: Build & Test Release x86 + if: (runner.os == 'Windows' && matrix.compiler != 'gcc') || runner.os == 'Linux' + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DDOCTEST_TEST_MODE=COMPARE + cmake --build build + cd build && ctest + + - name: Build & Test Debug x86 Valgrind + if: runner.os == 'Linux' + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-m32" -DDOCTEST_TEST_MODE=VALGRIND + cmake --build build + cd build && ctest + + - name: Build & Test Release x86 Valgrind + if: runner.os == 'Linux' + run: | + cmake -E remove_directory build + cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-m32" -DDOCTEST_TEST_MODE=VALGRIND + cmake --build build + cd build && ctest diff --git a/.github/workflows/vsenv.bat b/.github/workflows/vsenv.bat new file mode 100644 index 0000000..2b6e5f6 --- /dev/null +++ b/.github/workflows/vsenv.bat @@ -0,0 +1,17 @@ +@echo off + +SET VSWHERE="C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere" + +:: See https://github.com/microsoft/vswhere/wiki/Find-VC +for /f "usebackq delims=*" %%i in (`%VSWHERE% -latest -property installationPath`) do ( + call "%%i"\Common7\Tools\vsdevcmd.bat %* +) + +:: Loop over all environment variables and make them global using set-env. +:: See: https://help.github.com/en/articles/development-tools-for-github-actions#set-an-environment-variable-set-env +:: See: https://stackoverflow.com/questions/39183272/loop-through-all-environmental-variables-and-take-actions-depending-on-prefix +setlocal +for /f "delims== tokens=1,2" %%a in ('set') do ( + echo ::set-env name=%%a::%%b +) +endlocal diff --git a/.travis.yml b/.travis.yml index 64bc455..8e5fcc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -68,7 +68,7 @@ matrix: sources: *apt_sources # GCC 4.8 - - env: COMPILER=g++-4.8 HAS_ASAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults + - env: COMPILER=g++-4.8 HAS_ASAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults compiler: gcc addons: &gcc48 apt: @@ -76,7 +76,7 @@ matrix: sources: *apt_sources # GCC 4.9 - - env: COMPILER=g++-4.9 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults + - env: COMPILER=g++-4.9 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults compiler: gcc addons: &gcc49 apt: @@ -84,7 +84,7 @@ matrix: sources: *apt_sources # GCC 5 - - env: COMPILER=g++-5 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults + - env: COMPILER=g++-5 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults compiler: gcc addons: &gcc5 apt: @@ -92,7 +92,7 @@ matrix: sources: *apt_sources # GCC 6 - - env: COMPILER=g++-6 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults + - env: COMPILER=g++-6 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults compiler: gcc addons: &gcc6 apt: @@ -100,7 +100,7 @@ matrix: sources: *apt_sources # GCC 7 - - env: COMPILER=g++-7 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults + - env: COMPILER=g++-7 HAS_ASAN=true HAS_UBSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" # TSAN broken for some time - seg faults compiler: gcc sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033 addons: &gcc7 @@ -109,7 +109,7 @@ matrix: sources: *apt_sources # GCC 8 - - env: COMPILER=g++-8 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold" TSAN_CXX_FLAGS="-ltsan" + - env: COMPILER=g++-8 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" compiler: gcc sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033 addons: &gcc8 @@ -118,7 +118,7 @@ matrix: sources: *apt_sources # GCC 9 - - env: COMPILER=g++-9 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold" TSAN_CXX_FLAGS="-ltsan" + - env: COMPILER=g++-9 HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true SANITIZER_CXX_FLAGS="-fuse-ld=gold -static-libasan" TSAN_CXX_FLAGS="-ltsan" compiler: gcc sudo: required # see this issue for more details: https://github.com/travis-ci/travis-ci/issues/9033 addons: &gcc9 @@ -241,6 +241,11 @@ matrix: osx_image: xcode10.2 os: osx + # Xcode 11.2 Clang + - env: COMPILER=clang++ HAS_ASAN=true HAS_UBSAN=true HAS_TSAN=true + osx_image: xcode11.2 + os: osx + # OSX LLVM-GCC - env: COMPILER=g++ HAS_ASAN=true HAS_TSAN=true compiler: gcc diff --git a/CHANGELOG.md b/CHANGELOG.md index 1857847..193d6ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Change Log +## [2.3.6](https://github.com/onqtam/doctest/tree/2.3.6) (2019-12-17) +[Full Changelog](https://github.com/onqtam/doctest/compare/2.3.5...2.3.6) + +**Closed issues:** + +- \[Feature\] Better integration with tools \(VS Code Test Adapter Extension\) [\#320](https://github.com/onqtam/doctest/issues/320) +- Link problem w/ BUILD=Release if MESSAGE\(\) with std::string/ostream-operator is used [\#316](https://github.com/onqtam/doctest/issues/316) +- the FAQ about difference to Catch2 is missing tags [\#315](https://github.com/onqtam/doctest/issues/315) +- include Windows.h in small caps to silence clang warnings [\#312](https://github.com/onqtam/doctest/issues/312) +- Mistake in generator with lgtm error [\#311](https://github.com/onqtam/doctest/issues/311) +- CMake: cannot install target doctest\_with\_main [\#310](https://github.com/onqtam/doctest/issues/310) +- \[bug\] INFO\(\) and CAPTURE\(\) cannot compile using MSVC when used with DOCTEST\_CONFIG\_IMPLEMENTATION\_IN\_DLL [\#306](https://github.com/onqtam/doctest/issues/306) +- Skip subcase [\#304](https://github.com/onqtam/doctest/issues/304) +- Does some equivalent features from google test exist here? [\#300](https://github.com/onqtam/doctest/issues/300) +- How to use doctest in dll only\(without main.cpp and .exe\) [\#299](https://github.com/onqtam/doctest/issues/299) +- Warning: C26812: The enum type 'doctest::assertType::Enum' is unscoped. Prefer 'enum class' over 'enum' \(Enum.3\). [\#298](https://github.com/onqtam/doctest/issues/298) +- test executable\_dll\_and\_plugin fails on Linux, GCC 8.1.0, -fsanitize=address [\#201](https://github.com/onqtam/doctest/issues/201) + +**Merged pull requests:** + +- Fixed missing ostream include for MacOS when defining DOCTEST\_CONFIG\_… [\#314](https://github.com/onqtam/doctest/pull/314) ([NKTomHaygarth](https://github.com/NKTomHaygarth)) +- include windows.h in cmall caps to silence clang nonportable warnings [\#313](https://github.com/onqtam/doctest/pull/313) ([suoniq](https://github.com/suoniq)) +- Add .editorconfig file. [\#301](https://github.com/onqtam/doctest/pull/301) ([DaanDeMeyer](https://github.com/DaanDeMeyer)) +- Add Github Actions CI [\#285](https://github.com/onqtam/doctest/pull/285) ([DaanDeMeyer](https://github.com/DaanDeMeyer)) + ## [2.3.5](https://github.com/onqtam/doctest/tree/2.3.5) (2019-09-22) [Full Changelog](https://github.com/onqtam/doctest/compare/2.3.4...2.3.5) @@ -301,7 +326,7 @@ **Merged pull requests:** -- Added an option to not install Doctest in the CMake scripts [\#96](https://github.com/onqtam/doctest/pull/96) ([NeverMine17](https://github.com/NeverMine17)) +- Added an option to not install Doctest in the CMake scripts [\#96](https://github.com/onqtam/doctest/pull/96) ([nm17](https://github.com/nm17)) - Adding a defensive check against a null pointer for the current test suite [\#94](https://github.com/onqtam/doctest/pull/94) ([Lectem](https://github.com/Lectem)) - Remove incomplete copy ctor [\#93](https://github.com/onqtam/doctest/pull/93) ([McMartin](https://github.com/McMartin)) @@ -46,7 +46,7 @@ [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/503/badge)](https://bestpractices.coreinfrastructure.org/projects/503) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/onqtam/doctest.svg)](https://lgtm.com/projects/g/onqtam/doctest/context:cpp) [![Join the chat at https://gitter.im/onqtam/doctest](https://badges.gitter.im/onqtam/doctest.svg)](https://gitter.im/onqtam/doctest?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Try it online](https://img.shields.io/badge/try%20it-online-orange.svg)](https://wandbox.org/permlink/3J7otx2TvFQNSZsb) +[![Try it online](https://img.shields.io/badge/try%20it-online-orange.svg)](https://wandbox.org/permlink/IDMrgRGTk6aQ6GW8) <!-- [![Language](https://img.shields.io/badge/language-C++-blue.svg)](https://isocpp.org/) [![documentation](https://img.shields.io/badge/documentation%20%20-online-blue.svg)](https://github.com/onqtam/doctest/blob/master/doc/markdown/readme.md#reference) diff --git a/doc/markdown/faq.md b/doc/markdown/faq.md index 363deb9..069319a 100644 --- a/doc/markdown/faq.md +++ b/doc/markdown/faq.md @@ -35,7 +35,7 @@ Missing stuff: - matchers and generators - micro benchmarking support - nonius is used in [**Catch**](https://github.com/catchorg/Catch2) -- other small stuff +- other small stuff such as tags - can be easily emulated/migrated from - see below But these things (and more!) are planned in the [**roadmap**](roadmap.md)! diff --git a/doctest/doctest.h b/doctest/doctest.h index 8b76419..e41fbfe 100644 --- a/doctest/doctest.h +++ b/doctest/doctest.h @@ -48,8 +48,8 @@ #define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MINOR 3 -#define DOCTEST_VERSION_PATCH 5 -#define DOCTEST_VERSION_STR "2.3.5" +#define DOCTEST_VERSION_PATCH 6 +#define DOCTEST_VERSION_STR "2.3.6" #define DOCTEST_VERSION \ (DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH) @@ -157,7 +157,6 @@ DOCTEST_GCC_SUPPRESS_WARNING("-Wstrict-aliasing") DOCTEST_GCC_SUPPRESS_WARNING("-Wctor-dtor-privacy") DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations") DOCTEST_GCC_SUPPRESS_WARNING("-Wnon-virtual-dtor") -DOCTEST_GCC_SUPPRESS_WARNING("-Winline") DOCTEST_GCC_SUPPRESS_WARNING("-Wunused-local-typedefs") DOCTEST_GCC_SUPPRESS_WARNING("-Wuseless-cast") DOCTEST_GCC_SUPPRESS_WARNING("-Wnoexcept") @@ -182,6 +181,7 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26439) // This kind of function may not throw. Dec DOCTEST_MSVC_SUPPRESS_WARNING(26495) // Always initialize a member variable DOCTEST_MSVC_SUPPRESS_WARNING(26451) // Arithmetic overflow ... DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom construction and dtr... +DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum' // 4548 - expression before comma has no effect; expected expression with side - effect // 4265 - class has virtual functions, but destructor is not virtual @@ -369,10 +369,7 @@ DOCTEST_GCC_SUPPRESS_WARNING_POP #ifdef DOCTEST_CONFIG_USE_STD_HEADERS #include <iosfwd> #include <cstddef> -#if DOCTEST_MSVC >= DOCTEST_COMPILER(19, 20, 0) -// see this issue on why this is needed: https://github.com/onqtam/doctest/issues/183 #include <ostream> -#endif // VS 2019 #else // DOCTEST_CONFIG_USE_STD_HEADERS #if DOCTEST_CLANG @@ -1492,7 +1489,7 @@ namespace detail { void destroy(); }; - template <typename L> class DOCTEST_INTERFACE ContextScope : public ContextScopeBase + template <typename L> class ContextScope : public ContextScopeBase { const L &lambda_; @@ -1648,9 +1645,9 @@ struct DOCTEST_INTERFACE TestRunStats struct QueryData { - const TestRunStats* run_stats = nullptr; - String* data = nullptr; - unsigned num_data = 0; + const TestRunStats* run_stats = nullptr; + const TestCaseData** data = nullptr; + unsigned num_data = 0; }; struct DOCTEST_INTERFACE IReporter @@ -2659,7 +2656,6 @@ DOCTEST_GCC_SUPPRESS_WARNING("-Wstrict-aliasing") DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-field-initializers") DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-braces") DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations") -DOCTEST_GCC_SUPPRESS_WARNING("-Winline") DOCTEST_GCC_SUPPRESS_WARNING("-Wswitch") DOCTEST_GCC_SUPPRESS_WARNING("-Wswitch-enum") DOCTEST_GCC_SUPPRESS_WARNING("-Wswitch-default") @@ -2698,6 +2694,7 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26439) // This kind of function may not throw. Dec DOCTEST_MSVC_SUPPRESS_WARNING(26495) // Always initialize a member variable DOCTEST_MSVC_SUPPRESS_WARNING(26451) // Arithmetic overflow ... DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom construction and dtor... +DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum' DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN @@ -2754,7 +2751,7 @@ DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN #ifdef __AFXDLL #include <AfxWin.h> #else -#include <Windows.h> +#include <windows.h> #endif #include <io.h> @@ -4694,13 +4691,17 @@ namespace { .writeAttribute("priority", curr.first.first) .writeAttribute("name", curr.first.second); } else if(opt.count || opt.list_test_cases) { - for(unsigned i = 0; i < in.num_data; ++i) - xml.scopedElement("TestCase").writeAttribute("name", in.data[i]); + for(unsigned i = 0; i < in.num_data; ++i) { + xml.scopedElement("TestCase").writeAttribute("name", in.data[i]->m_name) + .writeAttribute("testsuite", in.data[i]->m_test_suite) + .writeAttribute("filename", skipPathFromFilename(in.data[i]->m_file)) + .writeAttribute("line", line(in.data[i]->m_line)); + } xml.scopedElement("OverallResultsTestCases") .writeAttribute("unskipped", in.run_stats->numTestCasesPassingFilters); } else if(opt.list_test_suites) { for(unsigned i = 0; i < in.num_data; ++i) - xml.scopedElement("TestSuite").writeAttribute("name", in.data[i]); + xml.scopedElement("TestSuite").writeAttribute("name", in.data[i]->m_test_suite); xml.scopedElement("OverallResultsTestCases") .writeAttribute("unskipped", in.run_stats->numTestCasesPassingFilters); xml.scopedElement("OverallResultsTestSuites") @@ -5120,7 +5121,7 @@ namespace { } for(unsigned i = 0; i < in.num_data; ++i) - s << Color::None << in.data[i] << "\n"; + s << Color::None << in.data[i]->m_name << "\n"; separator_to_stream(); @@ -5133,7 +5134,7 @@ namespace { separator_to_stream(); for(unsigned i = 0; i < in.num_data; ++i) - s << Color::None << in.data[i] << "\n"; + s << Color::None << in.data[i]->m_test_suite << "\n"; separator_to_stream(); @@ -5749,8 +5750,8 @@ int Context::run() { std::set<String> testSuitesPassingFilt; - bool query_mode = p->count || p->list_test_cases || p->list_test_suites; - std::vector<String> queryResults; + bool query_mode = p->count || p->list_test_cases || p->list_test_suites; + std::vector<const TestCaseData*> queryResults; if(!query_mode) DOCTEST_ITERATE_THROUGH_REPORTERS(test_run_start, DOCTEST_EMPTY); @@ -5796,14 +5797,14 @@ int Context::run() { // print the name of the test and don't execute it if(p->list_test_cases) { - queryResults.push_back(tc.m_name); + queryResults.push_back(&tc); continue; } // print the name of the test suite if not done already and don't execute it if(p->list_test_suites) { if((testSuitesPassingFilt.count(tc.m_test_suite) == 0) && tc.m_test_suite[0] != '\0') { - queryResults.push_back(tc.m_test_suite); + queryResults.push_back(&tc); testSuitesPassingFilt.insert(tc.m_test_suite); p->numTestSuitesPassingFilters++; } diff --git a/doctest/parts/doctest.cpp b/doctest/parts/doctest.cpp index e3fdd19..b369d85 100644 --- a/doctest/parts/doctest.cpp +++ b/doctest/parts/doctest.cpp @@ -44,7 +44,6 @@ DOCTEST_GCC_SUPPRESS_WARNING("-Wstrict-aliasing") DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-field-initializers") DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-braces") DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations") -DOCTEST_GCC_SUPPRESS_WARNING("-Winline") DOCTEST_GCC_SUPPRESS_WARNING("-Wswitch") DOCTEST_GCC_SUPPRESS_WARNING("-Wswitch-enum") DOCTEST_GCC_SUPPRESS_WARNING("-Wswitch-default") @@ -83,6 +82,7 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26439) // This kind of function may not throw. Dec DOCTEST_MSVC_SUPPRESS_WARNING(26495) // Always initialize a member variable DOCTEST_MSVC_SUPPRESS_WARNING(26451) // Arithmetic overflow ... DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom construction and dtor... +DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum' DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN @@ -139,7 +139,7 @@ DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN #ifdef __AFXDLL #include <AfxWin.h> #else -#include <Windows.h> +#include <windows.h> #endif #include <io.h> @@ -2079,13 +2079,17 @@ namespace { .writeAttribute("priority", curr.first.first) .writeAttribute("name", curr.first.second); } else if(opt.count || opt.list_test_cases) { - for(unsigned i = 0; i < in.num_data; ++i) - xml.scopedElement("TestCase").writeAttribute("name", in.data[i]); + for(unsigned i = 0; i < in.num_data; ++i) { + xml.scopedElement("TestCase").writeAttribute("name", in.data[i]->m_name) + .writeAttribute("testsuite", in.data[i]->m_test_suite) + .writeAttribute("filename", skipPathFromFilename(in.data[i]->m_file)) + .writeAttribute("line", line(in.data[i]->m_line)); + } xml.scopedElement("OverallResultsTestCases") .writeAttribute("unskipped", in.run_stats->numTestCasesPassingFilters); } else if(opt.list_test_suites) { for(unsigned i = 0; i < in.num_data; ++i) - xml.scopedElement("TestSuite").writeAttribute("name", in.data[i]); + xml.scopedElement("TestSuite").writeAttribute("name", in.data[i]->m_test_suite); xml.scopedElement("OverallResultsTestCases") .writeAttribute("unskipped", in.run_stats->numTestCasesPassingFilters); xml.scopedElement("OverallResultsTestSuites") @@ -2505,7 +2509,7 @@ namespace { } for(unsigned i = 0; i < in.num_data; ++i) - s << Color::None << in.data[i] << "\n"; + s << Color::None << in.data[i]->m_name << "\n"; separator_to_stream(); @@ -2518,7 +2522,7 @@ namespace { separator_to_stream(); for(unsigned i = 0; i < in.num_data; ++i) - s << Color::None << in.data[i] << "\n"; + s << Color::None << in.data[i]->m_test_suite << "\n"; separator_to_stream(); @@ -3134,8 +3138,8 @@ int Context::run() { std::set<String> testSuitesPassingFilt; - bool query_mode = p->count || p->list_test_cases || p->list_test_suites; - std::vector<String> queryResults; + bool query_mode = p->count || p->list_test_cases || p->list_test_suites; + std::vector<const TestCaseData*> queryResults; if(!query_mode) DOCTEST_ITERATE_THROUGH_REPORTERS(test_run_start, DOCTEST_EMPTY); @@ -3181,14 +3185,14 @@ int Context::run() { // print the name of the test and don't execute it if(p->list_test_cases) { - queryResults.push_back(tc.m_name); + queryResults.push_back(&tc); continue; } // print the name of the test suite if not done already and don't execute it if(p->list_test_suites) { if((testSuitesPassingFilt.count(tc.m_test_suite) == 0) && tc.m_test_suite[0] != '\0') { - queryResults.push_back(tc.m_test_suite); + queryResults.push_back(&tc); testSuitesPassingFilt.insert(tc.m_test_suite); p->numTestSuitesPassingFilters++; } diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h index 6645c57..dd2aef4 100644 --- a/doctest/parts/doctest_fwd.h +++ b/doctest/parts/doctest_fwd.h @@ -45,8 +45,8 @@ #define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MINOR 3 -#define DOCTEST_VERSION_PATCH 5 -#define DOCTEST_VERSION_STR "2.3.5" +#define DOCTEST_VERSION_PATCH 6 +#define DOCTEST_VERSION_STR "2.3.6" #define DOCTEST_VERSION \ (DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH) @@ -154,7 +154,6 @@ DOCTEST_GCC_SUPPRESS_WARNING("-Wstrict-aliasing") DOCTEST_GCC_SUPPRESS_WARNING("-Wctor-dtor-privacy") DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations") DOCTEST_GCC_SUPPRESS_WARNING("-Wnon-virtual-dtor") -DOCTEST_GCC_SUPPRESS_WARNING("-Winline") DOCTEST_GCC_SUPPRESS_WARNING("-Wunused-local-typedefs") DOCTEST_GCC_SUPPRESS_WARNING("-Wuseless-cast") DOCTEST_GCC_SUPPRESS_WARNING("-Wnoexcept") @@ -179,6 +178,7 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26439) // This kind of function may not throw. Dec DOCTEST_MSVC_SUPPRESS_WARNING(26495) // Always initialize a member variable DOCTEST_MSVC_SUPPRESS_WARNING(26451) // Arithmetic overflow ... DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom construction and dtr... +DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum' // 4548 - expression before comma has no effect; expected expression with side - effect // 4265 - class has virtual functions, but destructor is not virtual @@ -366,10 +366,7 @@ DOCTEST_GCC_SUPPRESS_WARNING_POP #ifdef DOCTEST_CONFIG_USE_STD_HEADERS #include <iosfwd> #include <cstddef> -#if DOCTEST_MSVC >= DOCTEST_COMPILER(19, 20, 0) -// see this issue on why this is needed: https://github.com/onqtam/doctest/issues/183 #include <ostream> -#endif // VS 2019 #else // DOCTEST_CONFIG_USE_STD_HEADERS #if DOCTEST_CLANG @@ -1489,7 +1486,7 @@ namespace detail { void destroy(); }; - template <typename L> class DOCTEST_INTERFACE ContextScope : public ContextScopeBase + template <typename L> class ContextScope : public ContextScopeBase { const L &lambda_; @@ -1645,9 +1642,9 @@ struct DOCTEST_INTERFACE TestRunStats struct QueryData { - const TestRunStats* run_stats = nullptr; - String* data = nullptr; - unsigned num_data = 0; + const TestRunStats* run_stats = nullptr; + const TestCaseData** data = nullptr; + unsigned num_data = 0; }; struct DOCTEST_INTERFACE IReporter diff --git a/examples/all_features/test_output/list_test_cases_xml.txt b/examples/all_features/test_output/list_test_cases_xml.txt index 9c67402..becaea5 100644 --- a/examples/all_features/test_output/list_test_cases_xml.txt +++ b/examples/all_features/test_output/list_test_cases_xml.txt @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <doctest binary="all_features"> <Options order_by="file" rand_seed="324" first="0" last="4294967295" abort_after="0" subcase_filter_levels="2147483647" case_sensitive="false" no_throw="false" no_skip="false"/> - <TestCase name="exercising tricky code paths of doctest"/> - <TestCase name="will end from a std::string exception"/> - <TestCase name="will end from a const char* exception"/> - <TestCase name="will end from an unknown exception"/> + <TestCase name="exercising tricky code paths of doctest" filename="coverage_maxout.cpp" line="0"/> + <TestCase name="will end from a std::string exception" testsuite="exception related" filename="coverage_maxout.cpp" line="0"/> + <TestCase name="will end from a const char* exception" testsuite="exception related" filename="coverage_maxout.cpp" line="0"/> + <TestCase name="will end from an unknown exception" testsuite="exception related" filename="coverage_maxout.cpp" line="0"/> <OverallResultsTestCases unskipped="4"/> </doctest> diff --git a/examples/all_features/test_output/version.txt b/examples/all_features/test_output/version.txt index fc63942..3374d5c 100644 --- a/examples/all_features/test_output/version.txt +++ b/examples/all_features/test_output/version.txt @@ -1 +1 @@ -[doctest] doctest version is "2.3.5" +[doctest] doctest version is "2.3.6" diff --git a/examples/all_features/test_output/version_xml.txt b/examples/all_features/test_output/version_xml.txt index 6d498cb..3136e50 100644 --- a/examples/all_features/test_output/version_xml.txt +++ b/examples/all_features/test_output/version_xml.txt @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> -<doctest binary="all_features" version="2.3.5"> +<doctest binary="all_features" version="2.3.6"> <Options order_by="file" rand_seed="324" first="0" last="4294967295" abort_after="0" subcase_filter_levels="2147483647" case_sensitive="false" no_throw="false" no_skip="false"/> </doctest> diff --git a/examples/executable_dll_and_plugin/main.cpp b/examples/executable_dll_and_plugin/main.cpp index 930efc0..0955091 100644 --- a/examples/executable_dll_and_plugin/main.cpp +++ b/examples/executable_dll_and_plugin/main.cpp @@ -24,7 +24,7 @@ TEST_CASE("executable") { #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN -#include <Windows.h> +#include <windows.h> DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END #ifdef _MSC_VER #define LoadDynamicLib(lib) LoadLibrary(lib ".dll") diff --git a/examples/executable_dll_and_plugin/plugin.cpp b/examples/executable_dll_and_plugin/plugin.cpp index 31695a4..dba953f 100644 --- a/examples/executable_dll_and_plugin/plugin.cpp +++ b/examples/executable_dll_and_plugin/plugin.cpp @@ -5,8 +5,16 @@ DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN #include <cstdio> DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END -TEST_CASE("plugin") { - printf("I am a test from the plugin!\n"); +// most of these are used here just to test that they compile successfully from within a plugin +TEST_SUITE("some test suite") { + TEST_CASE("test case in a plugin") { + SUBCASE("some subcase") { + INFO("some info"); + MESSAGE("triggering the INFO above to be printed"); + CHECK(1 == 2); + FAIL("certain death!"); + } + } } // set an exception translator for char diff --git a/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin.txt b/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin.txt index 6239c85..eef2081 100644 --- a/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin.txt +++ b/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin.txt @@ -9,8 +9,23 @@ TEST CASE: executable main.cpp(0): ERROR: test case THREW exception: char: 97 -I am a test from the plugin! =============================================================================== -[doctest] test cases: 5 | 4 passed | 1 failed | 0 skipped -[doctest] assertions: 0 | 0 passed | 0 failed | +plugin.cpp(0): +TEST SUITE: some test suite +TEST CASE: test case in a plugin + some subcase + +plugin.cpp(0): MESSAGE: triggering the INFO above to be printed + logged: some info + +plugin.cpp(0): ERROR: CHECK( 1 == 2 ) is NOT correct! + values: CHECK( 1 == 2 ) + logged: some info + +plugin.cpp(0): FATAL ERROR: certain death! + logged: some info + +=============================================================================== +[doctest] test cases: 5 | 3 passed | 2 failed | 0 skipped +[doctest] assertions: 2 | 0 passed | 2 failed | [doctest] Status: FAILURE! diff --git a/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin_xml.txt b/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin_xml.txt index 75730d8..b8d3b4f 100644 --- a/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin_xml.txt +++ b/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin_xml.txt @@ -21,11 +21,41 @@ I am a test from the executable! </Exception> <OverallResultsAsserts successes="0" failures="0"/> </TestCase> - <TestCase name="plugin" filename="plugin.cpp" line="0"> -I am a test from the plugin! - <OverallResultsAsserts successes="0" failures="0"/> + </TestSuite> + <TestSuite name="some test suite"> + <TestCase name="test case in a plugin" filename="plugin.cpp" line="0"> + <SubCase name="some subcase" filename="plugin.cpp" line="0"> + <Message type="WARNING" filename="plugin.cpp" line="0"> + <Text> + triggering the INFO above to be printed + </Text> + <Info> + some info + </Info> + </Message> + <Expression success="false" type="CHECK" filename="plugin.cpp" line="0"> + <Original> + 1 == 2 + </Original> + <Expanded> + 1 == 2 + </Expanded> + <Info> + some info + </Info> + </Expression> + <Message type="FATAL ERROR" filename="plugin.cpp" line="0"> + <Text> + certain death! + </Text> + <Info> + some info + </Info> + </Message> + </SubCase> + <OverallResultsAsserts successes="0" failures="2"/> </TestCase> </TestSuite> - <OverallResultsAsserts successes="0" failures="0"/> - <OverallResultsTestCases successes="4" failures="1" skipped="0"/> + <OverallResultsAsserts successes="0" failures="2"/> + <OverallResultsTestCases successes="3" failures="2" skipped="0"/> </doctest> diff --git a/meson.build b/meson.build index 6a16435..1075a85 100644 --- a/meson.build +++ b/meson.build @@ -1,2 +1,2 @@ -project('doctest', ['cpp'], version: '2.3.5', meson_version:'>=0.50') +project('doctest', ['cpp'], version: '2.3.6', meson_version:'>=0.50') doctest_dep = declare_dependency(include_directories: include_directories('doctest')) diff --git a/scripts/cmake/common.cmake b/scripts/cmake/common.cmake index c62b9a0..0ce359f 100644 --- a/scripts/cmake/common.cmake +++ b/scripts/cmake/common.cmake @@ -108,7 +108,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") add_compiler_flags(-Wsign-conversion) add_compiler_flags(-Wdisabled-optimization) add_compiler_flags(-Weffc++) - add_compiler_flags(-Winline) add_compiler_flags(-Winvalid-pch) add_compiler_flags(-Wmissing-declarations) add_compiler_flags(-Woverloaded-virtual) @@ -162,11 +161,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") endif() endif() -if(CMAKE_VERSION VERSION_LESS 3.8) - # necessary for some older compilers which don't default to C++11 - set(CMAKE_CXX_STANDARD 11) - set(CXX_STANDARD_REQUIRED ON) -endif() +# necessary for some older compilers which don't default to C++11 +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compiler_flags(-Weverything) diff --git a/scripts/cmake/exec_test.cmake b/scripts/cmake/exec_test.cmake index 3ea352f..ab51a01 100644 --- a/scripts/cmake/exec_test.cmake +++ b/scripts/cmake/exec_test.cmake @@ -32,7 +32,11 @@ if("${TEST_MODE}" STREQUAL "COMPARE") execute_process(COMMAND dos2unix ${TEST_TEMP_FILE}) endif() - execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_OUTPUT_FILE} ${TEST_TEMP_FILE} RESULT_VARIABLE cmp_result) + if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.14.0") + set(IGNORE_EOL --ignore-eol) + endif() + + execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files ${IGNORE_EOL} ${TEST_OUTPUT_FILE} ${TEST_TEMP_FILE} RESULT_VARIABLE cmp_result) if(cmp_result) find_package(Git) diff --git a/scripts/version.txt b/scripts/version.txt index 3b26524..0501b79 100644 --- a/scripts/version.txt +++ b/scripts/version.txt @@ -1 +1 @@ -2.3.5
\ No newline at end of file +2.3.6
\ No newline at end of file |