Fixed bad line entry for #1422

This commit is contained in:
Mike Farah 2022-11-15 11:35:31 +11:00
parent b202ccc5dc
commit cb609a1886
2 changed files with 14 additions and 11 deletions

View File

@ -268,7 +268,10 @@ func parseSnippet(value string) (*yaml.Node, error) {
if len(parsedNode.Node.Content) == 0 {
return nil, fmt.Errorf("bad data")
}
return unwrapDoc(parsedNode.Node), err
result := unwrapDoc(parsedNode.Node)
result.Line = 0
result.Column = 0
return result, err
}
func recursiveNodeEqual(lhs *yaml.Node, rhs *yaml.Node) bool {

View File

@ -38,8 +38,8 @@ var parseSnippetScenarios = []parseSnippetScenario{
Kind: yaml.ScalarNode,
Tag: "!!null",
Value: "null",
Line: 1,
Column: 1,
Line: 0,
Column: 0,
},
},
{
@ -48,8 +48,8 @@ var parseSnippetScenarios = []parseSnippetScenario{
Kind: yaml.ScalarNode,
Tag: "!!int",
Value: "3",
Line: 1,
Column: 1,
Line: 0,
Column: 0,
},
},
{
@ -58,8 +58,8 @@ var parseSnippetScenarios = []parseSnippetScenario{
Kind: yaml.ScalarNode,
Tag: "!!str",
Value: "cat",
Line: 1,
Column: 1,
Line: 0,
Column: 0,
},
},
{
@ -68,8 +68,8 @@ var parseSnippetScenarios = []parseSnippetScenario{
Kind: yaml.ScalarNode,
Tag: "!!float",
Value: "3.1",
Line: 1,
Column: 1,
Line: 0,
Column: 0,
},
},
{
@ -78,8 +78,8 @@ var parseSnippetScenarios = []parseSnippetScenario{
Kind: yaml.ScalarNode,
Tag: "!!bool",
Value: "true",
Line: 1,
Column: 1,
Line: 0,
Column: 0,
},
},
}