Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cpjulia committed Sep 1, 2022
1 parent 56cc352 commit 9476de9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/testsDumper.cpp
Expand Up @@ -476,6 +476,26 @@ TEST(StringDumperTest, StringControlChars) {
Dumper::toString(slice));
}

TEST(StringDumperTest, SuppressControlChars) {
Builder b;
b.add(Value("Before\nAfter\r\t\v\x01\x02"));

Options options;
options.escapeControl = false;
ASSERT_EQ(std::string("\"Before After \""),
Dumper::toString(b.slice(), &options));
}

TEST(StringDumperTest, EscapeControlChars) {
Builder b;
b.add(Value("Before\nAfter\r\t\v\x01\x02"));

Options options;
options.escapeControl = true;
ASSERT_EQ(std::string("\"Before\\nAfter\\r\\t\\u000B\\u0001\\u0002\""),
Dumper::toString(b.slice(), &options));
}

TEST(StringDumperTest, StringUTF8) {
Builder b;
b.add(Value("mötör"));
Expand Down

0 comments on commit 9476de9

Please sign in to comment.