diff options
Diffstat (limited to 'toolsrc/src/vcpkg-test/json.cpp')
| -rw-r--r-- | toolsrc/src/vcpkg-test/json.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/toolsrc/src/vcpkg-test/json.cpp b/toolsrc/src/vcpkg-test/json.cpp index 0b9941861..6858a5ac8 100644 --- a/toolsrc/src/vcpkg-test/json.cpp +++ b/toolsrc/src/vcpkg-test/json.cpp @@ -28,8 +28,8 @@ static std::string mystringify(const Value& val) { return Json::stringify(val, J TEST_CASE ("JSON stringify weird strings", "[json]") { - vcpkg::StringView str = U8_STR("😀 😁 😂 🤣 😃 😄 😅 😆 😉"); - REQUIRE(mystringify(Value::string(str)) == ('"' + str.to_string() + "\"\n")); + std::string str = U8_STR("😀 😁 😂 🤣 😃 😄 😅 😆 😉"); + REQUIRE(mystringify(Value::string(str)) == ('"' + str + "\"\n")); REQUIRE(mystringify(Value::string("\xED\xA0\x80")) == "\"\\ud800\"\n"); // unpaired surrogate } @@ -228,3 +228,14 @@ TEST_CASE ("JSON parse full file", "[json]") } REQUIRE(res); } + +TEST_CASE ("JSON track newlines", "[json]") +{ + auto res = Json::parse("{\n,", fs::u8path("filename")); + REQUIRE(!res); + REQUIRE(res.error()->format() == + R"(Error: filename:2:1: Unexpected character; expected property name + on expression: , + ^ +)"); +} |
