File tree Expand file tree Collapse file tree 5 files changed +7
-8
lines changed
src/ArduinoJson/Strings/Adapters Expand file tree Collapse file tree 5 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ TEST_CASE("JsonDocument::remove()") {
2222
2323 SECTION (" string literal" ) {
2424 doc[" a" ] = 1 ;
25- doc[" a \0 b " _s ] = 2 ;
25+ doc[" x " ] = 2 ;
2626 doc[" b" ] = 3 ;
2727
28- doc.remove (" a \0 b " );
28+ doc.remove (" x " );
2929
3030 REQUIRE (doc.as <std::string>() == " {\" a\" :1,\" b\" :3}" );
3131 }
Original file line number Diff line number Diff line change @@ -25,8 +25,6 @@ TEST_CASE("JsonDocument::operator[]") {
2525 SECTION (" string literal" ) {
2626 REQUIRE (doc[" abc" ] == " ABC" );
2727 REQUIRE (cdoc[" abc" ] == " ABC" );
28- REQUIRE (doc[" abc\0 d" ] == " ABCD" );
29- REQUIRE (cdoc[" abc\0 d" ] == " ABCD" );
3028 }
3129
3230 SECTION (" std::string" ) {
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ TEST_CASE("JsonVariantConst::operator[]") {
5757 SECTION (" string literal" ) {
5858 REQUIRE (var[" ab" ] == " AB" _s);
5959 REQUIRE (var[" abc" ] == " ABC" _s);
60- REQUIRE (var[" abc\0 d" ] == " ABCD " _s);
60+ REQUIRE (var[" abc\0 d" ] == " ABC " _s);
6161 REQUIRE (var[" def" ].isNull ());
6262 REQUIRE (var[0 ].isNull ());
6363 }
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ TEST_CASE("adaptString()") {
2121 auto s = adaptString (" bravo\0 alpha" );
2222
2323 CHECK (s.isNull () == false );
24- CHECK (s.size () == 11 );
24+ CHECK (s.size () == 5 );
2525 CHECK (s.isStatic () == true );
2626 }
2727
Original file line number Diff line number Diff line change @@ -80,8 +80,9 @@ template <size_t N>
8080struct StringAdapter <const char (&)[N]> {
8181 using AdaptedString = RamString;
8282
83- static AdaptedString adapt (const char (&p)[N]) {
84- return RamString (p, N - 1 , true );
83+ static AdaptedString adapt (const char * p) {
84+ ARDUINOJSON_ASSERT (p);
85+ return RamString (p, ::strlen (p), true );
8586 }
8687};
8788
You can’t perform that action at this time.
0 commit comments