Skip to content

Commit

Permalink
Fix build on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
Neverlord committed Dec 17, 2023
1 parent cb6ac57 commit ef16f51
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions tests/cpp/format/json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,13 @@ TEST(real) {
}

TEST(string) {
// Note: putting these literals into CHECK_EQUAL confuses MSVC.
auto foobar = "foo\n\"bar"s;
auto foobar_res = R"_({"@data-type":"string","data":"foo\n\"bar"})_";
CHECK_EQUAL(to_v1("foo"sv), R"_({"@data-type":"string","data":"foo"})_");
CHECK_EQUAL(to_v1("foo\nbar"sv),
R"_({"@data-type":"string","data":"foo\nbar"})_");
CHECK_EQUAL(to_v1("foo\n\"bar"sv),
R"_({"@data-type":"string","data":"foo\n\"bar"})_");
CHECK_EQUAL(to_v1(foobar), foobar_res);
CHECK_EQUAL(to_v1(data{"foo"s}), R"_({"@data-type":"string","data":"foo"})_");
CHECK_EQUAL(to_v1(data{"foo\nbar"s}),
R"_({"@data-type":"string","data":"foo\nbar"})_");
CHECK_EQUAL(to_v1(data{"foo\n\"bar"s}),
R"_({"@data-type":"string","data":"foo\n\"bar"})_");
CHECK_EQUAL(to_v1(data{foobar}), foobar_res);
}

TEST(address) {
Expand Down Expand Up @@ -198,18 +195,15 @@ TEST(timestamp) {
}

TEST(enum_value) {
// Note: putting these literals into CHECK_EQUAL confuses MSVC.
auto foobar = "foo\n\"bar"s;
auto foobar_res = R"_({"@data-type":"enum-value","data":"foo\n\"bar"})_";
CHECK_EQUAL(to_v1(enum_value{"foo"}),
R"_({"@data-type":"enum-value","data":"foo"})_");
CHECK_EQUAL(to_v1(enum_value{"foo\nbar"}),
R"_({"@data-type":"enum-value","data":"foo\nbar"})_");
CHECK_EQUAL(to_v1(enum_value{"foo\n\"bar"}),
R"_({"@data-type":"enum-value","data":"foo\n\"bar"})_");
CHECK_EQUAL(to_v1(foobar), foobar_res);
CHECK_EQUAL(to_v1(data{enum_value{"foo"}}),
R"_({"@data-type":"enum-value","data":"foo"})_");
CHECK_EQUAL(to_v1(data{enum_value{"foo\nbar"}}),
R"_({"@data-type":"enum-value","data":"foo\nbar"})_");
CHECK_EQUAL(to_v1(data{enum_value{"foo\n\"bar"}}),
R"_({"@data-type":"enum-value","data":"foo\n\"bar"})_");
CHECK_EQUAL(to_v1(data{enum_value{foobar}}), foobar_res);
}

TEST(vector) {
Expand Down

0 comments on commit ef16f51

Please sign in to comment.