Fix formatting when writing \ as a character.

This commit is contained in:
Jesse Beder
2016-10-11 23:58:03 -05:00
parent 85af926ddc
commit 086fec5c35
2 changed files with 10 additions and 0 deletions

View File

@@ -970,6 +970,14 @@ TEST_F(EmitterTest, ValueOfDoubleQuote) {
ExpectEmit("foo: \"\\\"\"");
}
TEST_F(EmitterTest, ValueOfBackslash) {
out << YAML::BeginMap;
out << YAML::Key << "foo" << YAML::Value << '\\';
out << YAML::EndMap;
ExpectEmit("foo: \"\\\\\"");
}
class EmitterErrorTest : public ::testing::Test {
protected:
void ExpectEmitError(const std::string& expectedError) {