Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/UsageTests/ToStringVector.tests.cpp
diff options
context:
space:
mode:
authorPhil Nash2018-01-04 10:05:02 +0000
committerPhil Nash2018-01-04 10:05:02 +0000
commit702cfdaf6e3e79f4485190d7f3b4beb2d12ac854 (patch)
treea8edb8a3b2b392d1fa249c481cc1aba30d784d89 /projects/SelfTest/UsageTests/ToStringVector.tests.cpp
parente41e8e8384c415a875309180e9d310a8da9972c4 (diff)
downloadcatch3-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.cpp10
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 }");
+}