Skip to content

Commit

Permalink
Fix block entry indicator check
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma committed Sep 17, 2022
1 parent fd6731d commit f35e5e7
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 f35e5e7

Please sign in to comment.