Skip to content

Commit

Permalink
Merge pull request #710 from lahma/fix-key-indicator
Browse files Browse the repository at this point in the history
Fix block entry indicator check

+semver:fix
  • Loading branch information
EdwardCooke committed Sep 17, 2022
2 parents fd6731d + f35e5e7 commit 454171b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions YamlDotNet.Test/RepresentationModel/YamlStreamTests.cs
Expand Up @@ -218,6 +218,16 @@ public void AllAliasesMustBeResolved()
Assert.Throws<AnchorNotFoundException>(() => original.Load(Yaml.ReaderFrom("invalid-reference.yaml")));
}

[Fact]
public void CanReadValueWithQuotes()
{
var yamlStream = new YamlStream();
yamlStream.Load(Yaml.ParserForText("description: -\"\" should be zero"));
var nodes = yamlStream.Documents.Single().AllNodes.ToArray();
Assert.Equal("description", nodes[1].ToString());
Assert.Equal("-\"\" should be zero", nodes[2].ToString());
}

private void RoundtripTest(string yamlFileName)
{
var original = new YamlStream();
Expand Down
2 changes: 1 addition & 1 deletion YamlDotNet/Core/Scanner.cs
Expand Up @@ -398,7 +398,7 @@ private void FetchNextToken()
FetchBlockEntry();
return;
}
else if (analyzer.Check("?:,[]{}#&*!|>'\"%@`", 1))
else if (analyzer.Check(",[]{}", 1))
{
tokens.Enqueue(new Error("Invalid key indicator format.", cursor.Mark(), cursor.Mark()));
}
Expand Down

0 comments on commit 454171b

Please sign in to comment.