This commit is contained in:
dota17 2020-06-30 11:31:09 +08:00
parent 3f381f13a0
commit 5ecee55f4e
2 changed files with 8 additions and 1 deletions

View File

@ -69,7 +69,7 @@ inline const RegEx& Hex() {
inline const RegEx& NotPrintable() {
static const RegEx e =
RegEx(0) |
RegEx("\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x7F", REGEX_OR) |
RegEx("\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x7F", REGEX_OR) |
RegEx(0x0E, 0x1F) |
(RegEx('\xC2') + (RegEx('\x80', '\x84') | RegEx('\x86', '\x9F')));
return e;

View File

@ -1127,6 +1127,13 @@ TEST_F(EmitterTest, SingleChar) {
ExpectEmit("- a\n- \":\"\n- \"\\x10\"\n- \"\\n\"\n- \" \"\n- \"\\t\"");
}
TEST_F(EmitterTest, EscepeCharOnMap) {
out << BeginMap;
out << Key << "key" << Value << "\rvalue";
out << EndMap;
ExpectEmit("key: \"\\rvalue\"");
}
TEST_F(EmitterTest, DefaultPrecision) {
out << BeginSeq;
out << 1.3125f;