diff options
| author | Phil Nash | 2018-01-04 10:05:02 +0000 |
|---|---|---|
| committer | Phil Nash | 2018-01-04 10:05:02 +0000 |
| commit | 702cfdaf6e3e79f4485190d7f3b4beb2d12ac854 (patch) | |
| tree | a8edb8a3b2b392d1fa249c481cc1aba30d784d89 /projects/SelfTest/UsageTests/ToStringVector.tests.cpp | |
| parent | e41e8e8384c415a875309180e9d310a8da9972c4 (diff) | |
| download | catch3-702cfdaf6e3e79f4485190d7f3b4beb2d12ac854.tar.gz | |
Added special handling for vector<bool> when stringifying
Diffstat (limited to 'projects/SelfTest/UsageTests/ToStringVector.tests.cpp')
| -rw-r--r-- | projects/SelfTest/UsageTests/ToStringVector.tests.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/projects/SelfTest/UsageTests/ToStringVector.tests.cpp b/projects/SelfTest/UsageTests/ToStringVector.tests.cpp index df9c55ab..0b993c4e 100644 --- a/projects/SelfTest/UsageTests/ToStringVector.tests.cpp +++ b/projects/SelfTest/UsageTests/ToStringVector.tests.cpp @@ -66,3 +66,13 @@ TEST_CASE( "vec<vec<string,alloc>> -> toString", "[toString][vector,allocator]" v.push_back( inner { "world" } ); REQUIRE( ::Catch::Detail::stringify(v) == "{ { \"hello\" }, { \"world\" } }" ); } + +// Based on PR by mat-so: https://github.com/catchorg/Catch2/pull/606/files#diff-43562f40f8c6dcfe2c54557316e0f852 +TEST_CASE( "vector<bool> -> toString", "[toString][containers][vector]" ) { + std::vector<bool> bools; + REQUIRE( ::Catch::Detail::stringify(bools) == "{ }"); + bools.push_back(true); + REQUIRE( ::Catch::Detail::stringify(bools) == "{ true }"); + bools.push_back(false); + REQUIRE( ::Catch::Detail::stringify(bools) == "{ true, false }"); +} |