@@ -116,12 +116,12 @@ TEST_CASE("StringBuilder") {
116116 }
117117}
118118
119- static JsonString saveString (StringBuilder& builder, const char * s) {
119+ static VariantData saveString (StringBuilder& builder, const char * s) {
120120 VariantData data;
121121 builder.startString ();
122122 builder.append (s);
123123 builder.save (&data);
124- return data. asString () ;
124+ return data;
125125}
126126
127127TEST_CASE (" StringBuilder::save() deduplicates strings" ) {
@@ -134,9 +134,9 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
134134 auto s2 = saveString (builder, " world" );
135135 auto s3 = saveString (builder, " hello" );
136136
137- REQUIRE (s1 == " hello" );
138- REQUIRE (s2 == " world" );
139- REQUIRE (+s1.c_str () == +s3.c_str ()); // same address
137+ REQUIRE (s1. asString () == " hello" );
138+ REQUIRE (s2. asString () == " world" );
139+ REQUIRE (+s1.asString (). c_str () == +s3. asString () .c_str ()); // same address
140140
141141 REQUIRE (spy.log () ==
142142 AllocatorLog{
@@ -152,9 +152,10 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
152152 auto s1 = saveString (builder, " hello world" );
153153 auto s2 = saveString (builder, " hello" );
154154
155- REQUIRE (s1 == " hello world" );
156- REQUIRE (s2 == " hello" );
157- REQUIRE (+s2.c_str () != +s1.c_str ()); // different address
155+ REQUIRE (s1.asString () == " hello world" );
156+ REQUIRE (s2.asString () == " hello" );
157+ REQUIRE (+s2.asString ().c_str () !=
158+ +s1.asString ().c_str ()); // different address
158159
159160 REQUIRE (spy.log () ==
160161 AllocatorLog{
@@ -169,9 +170,10 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
169170 auto s1 = saveString (builder, " hello world" );
170171 auto s2 = saveString (builder, " worl" );
171172
172- REQUIRE (s1 == " hello world" );
173- REQUIRE (s2 == " worl" );
174- REQUIRE (s2.c_str () != s1.c_str ()); // different address
173+ REQUIRE (s1.asString () == " hello world" );
174+ REQUIRE (s2.asString () == " worl" );
175+ REQUIRE (s2.asString ().c_str () !=
176+ s1.asString ().c_str ()); // different address
175177
176178 REQUIRE (spy.log () ==
177179 AllocatorLog{
0 commit comments