From 2b9e9ab43e346e31d1e6d25d18371d8a82c3a8e7 Mon Sep 17 00:00:00 2001 From: Harald Frostel Date: Fri, 3 May 2019 01:44:57 +0200 Subject: [PATCH 1/2] Test for StreamString SSO bug (#6035) --- tests/host/core/test_string.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/host/core/test_string.cpp b/tests/host/core/test_string.cpp index df08d9a00e..821feed30a 100644 --- a/tests/host/core/test_string.cpp +++ b/tests/host/core/test_string.cpp @@ -17,6 +17,7 @@ #include #include #include +#include TEST_CASE("String::trim", "[core][String]") { @@ -440,3 +441,14 @@ TEST_CASE("Issue #5949 - Overlapping src/dest in replace", "[core][String]") blah.replace(blah, blah); REQUIRE(blah == "blah"); } + + +TEST_CASE("Issue #2736 - StreamString SSO fix", "[core][StreamString]") +{ + StreamString s; + s.print('{'); + s.print('\"'); + s.print(String("message")); + s.print('\"'); + REQUIRE(blah == "{\"message\""); +} From e8aa46b5c5856771849a0447a62e6a86f8121df7 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Thu, 2 May 2019 19:33:16 -0700 Subject: [PATCH 2/2] Fix typo in variable name --- tests/host/core/test_string.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/host/core/test_string.cpp b/tests/host/core/test_string.cpp index 821feed30a..f5865b8e80 100644 --- a/tests/host/core/test_string.cpp +++ b/tests/host/core/test_string.cpp @@ -450,5 +450,5 @@ TEST_CASE("Issue #2736 - StreamString SSO fix", "[core][StreamString]") s.print('\"'); s.print(String("message")); s.print('\"'); - REQUIRE(blah == "{\"message\""); + REQUIRE(s == "{\"message\""); }