test: fixes test for NBSP (non-break space)

This fixes the example "Example 5.13 Escaped Characters" from the YAML
specification.

The example demands that `\_` is being translated to unicode `\u00a0`.
The unicode codepoint `\u00A0` encoded for utf-8 in hex is `\xC2\xA0`.

Fixing this test case will cause the unit test to not pass, since the
codepoint `\u00A0` is not handled correctly.
(Failing unittest is expected).
This commit is contained in:
Simon Gene Gottlieb
2026-02-17 22:10:02 +01:00
committed by Jesse Beder
parent f25f110e33
commit 3e53605a31
2 changed files with 2 additions and 2 deletions

View File

@@ -751,7 +751,7 @@ TEST_F(HandlerSpecTest, Ex5_13_EscapedCharacters) {
OnScalar(_, "!", 0, OnScalar(_, "!", 0,
"Fun with \x5C \x22 \x07 \x08 \x1B \x0C \x0A \x0D \x09 \x0B " + "Fun with \x5C \x22 \x07 \x08 \x1B \x0C \x0A \x0D \x09 \x0B " +
std::string("\x00", 1) + std::string("\x00", 1) +
" \x20 \xA0 \x85 \xe2\x80\xa8 \xe2\x80\xa9 A A A")); " \x20 \xC2\xA0 \x85 \xe2\x80\xa8 \xe2\x80\xa9 A A A"));
EXPECT_CALL(handler, OnDocumentEnd()); EXPECT_CALL(handler, OnDocumentEnd());
Parse(ex5_13); Parse(ex5_13);
} }

View File

@@ -467,7 +467,7 @@ TEST(NodeSpecTest, Ex5_13_EscapedCharacters) {
EXPECT_TRUE(doc.as<std::string>() == EXPECT_TRUE(doc.as<std::string>() ==
"Fun with \x5C \x22 \x07 \x08 \x1B \x0C \x0A \x0D \x09 \x0B " + "Fun with \x5C \x22 \x07 \x08 \x1B \x0C \x0A \x0D \x09 \x0B " +
std::string("\x00", 1) + std::string("\x00", 1) +
" \x20 \xA0 \x85 \xe2\x80\xa8 \xe2\x80\xa9 A A A"); " \x20 \xC2\xA0 \x85 \xe2\x80\xa8 \xe2\x80\xa9 A A A");
} }
TEST(NodeSpecTest, Ex5_14_InvalidEscapedCharacters) { TEST(NodeSpecTest, Ex5_14_InvalidEscapedCharacters) {