diff --git a/.travis.yml b/.travis.yml index 280c2c06c0..d5811eebd8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -218,6 +218,17 @@ matrix: sources: ['ubuntu-toolchain-r-test'] packages: ['g++-9', 'ninja-build'] + - os: linux + compiler: gcc + env: + - COMPILER=g++-9 + - CXXFLAGS=-std=c++17 + - CMAKE_CXX_STANDARD=17 + addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-9', 'ninja-build'] + # Linux / Clang - os: linux @@ -328,7 +339,11 @@ script: # compile and execute unit tests - mkdir -p build && cd build - - cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -GNinja && cmake --build . --config Release + - if [[ "${CMAKE_CXX_STANDARD}" != "" ]]; then + cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} -GNinja && cmake --build . --config Release ; + else + cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -GNinja && cmake --build . --config Release ; + fi - ctest -C Release --timeout 2700 -V -j - cd .. diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp index 2fce369616..476a2149d9 100644 --- a/test/src/unit-conversions.cpp +++ b/test/src/unit-conversions.cpp @@ -1710,7 +1710,8 @@ TEST_CASE("std::optional") std::optional opt_null; CHECK(json(opt_null) == j_null); - CHECK(std::optional(j_null) == std::nullopt); + CHECK_THROWS_WITH(std::optional(j_null) == std::nullopt, + "[json.exception.type_error.302] type must be string, but is null"); } SECTION("string") @@ -1746,7 +1747,8 @@ TEST_CASE("std::optional") std::vector> opt_array = {{1, 2, std::nullopt}}; CHECK(json(opt_array) == j_array); - CHECK(std::vector>(j_array) == opt_array); + std::vector> tmp = j_array; + CHECK(tmp == opt_array); } SECTION("object") @@ -1755,7 +1757,8 @@ TEST_CASE("std::optional") std::map> opt_object {{"one", 1}, {"two", 2}, {"zero", std::nullopt}}; CHECK(json(opt_object) == j_object); - CHECK(std::map>(j_object) == opt_object); + std::map> tmp =j_object; + CHECK(tmp == opt_object); } } #endif