takes a byte literal of the form b'...', b'''...'''
| 87 | |
| 88 | // <quoted> takes a byte literal of the form b'...', b'''...''' |
| 89 | void TestBytesLiteral(const std::string& quoted) { |
| 90 | // Parse the literal. |
| 91 | ASSERT_OK_AND_ASSIGN(auto unquoted, ParseBytesLiteral(quoted)); |
| 92 | |
| 93 | // Take the parsed literal and turn it back to a literal. |
| 94 | std::string requoted = FormatBytesLiteral(unquoted); |
| 95 | // Parse it again. |
| 96 | ASSERT_OK_AND_ASSIGN(auto unquoted2, ParseBytesLiteral(requoted)); |
| 97 | // Test the parsed literal forms for equality, not the unparsed forms. |
| 98 | // This is because the unparsed forms can have different representations for |
| 99 | // the same data, i.e., \000 and \x00. |
| 100 | EXPECT_EQ(unquoted, unquoted2) |
| 101 | << "unquoted : " << unquoted << "\nunquoted2: " << unquoted2; |
| 102 | |
| 103 | TestBytesEscaping(unquoted, quoted); |
| 104 | } |
| 105 | |
| 106 | // <quoted> takes a raw byte literal of the form rb'...', br'...', rb'''...''' |
| 107 | // or br'''...'''. <unquoted> is the expected parsed form of <quoted>. |
no test coverage detected