diff --git a/YamlDotNet.Test/Core/EmitterTests.cs b/YamlDotNet.Test/Core/EmitterTests.cs index aa7fe34c..66c3b52b 100644 --- a/YamlDotNet.Test/Core/EmitterTests.cs +++ b/YamlDotNet.Test/Core/EmitterTests.cs @@ -443,6 +443,15 @@ public void SingleQuotesAreNotDoubleQuotedUnlessNecessary(string input) yaml.Should().NotContain("\""); } + [Theory] + [InlineData(@"\hello world")] + public void LeadingBackslashIsNotQuotedUnlessNecessary(string input) + { + var events = StreamOf(DocumentWith(new Scalar(input))); + var yaml = EmittedTextFrom(events); + yaml.Should().NotContain("\'"); + } + private string Lines(params string[] lines) { return string.Join(Environment.NewLine, lines);