mirror of
https://github.com/nlohmann/json.git
synced 2026-10-07 06:57:14 +00:00
Fix CI: keep raw strings with backslashes out of test macros for MSVC
MSVC stringizes the arguments of doctest's CHECK() so that a raw string literal becomes an ordinary one, and then reported the "\q" in the new alt_string recovery test as warning C4129, an error with /WX. The input is now a variable. The same pattern with "\u0000" in the parser's recovery test is replaced by a JSON value built from a std::string. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+4
-2
No files matched your search
@@ -395,7 +395,9 @@ TEST_CASE("alternative string type")
|
||||
|
||||
alt_json j;
|
||||
recovering_parser sax(j);
|
||||
CHECK(!alt_json::sax_parse(R"([1., "a\qb", tru, {"k" 2}])", &sax));
|
||||
// not inside CHECK(): MSVC reads the escape in a stringized raw string
|
||||
const std::string input = R"([1., "a\qb", tru, {"k" 2}])";
|
||||
CHECK(!alt_json::sax_parse(input, &sax));
|
||||
CHECK(sax.errors == 4);
|
||||
CHECK(j.dump() == R"([1,"aqb",null,{"k":2}])");
|
||||
|
||||
|
||||
Reference in new issue
Block a user