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 { if len(parsedNode.Node.Content) == 0 {
return nil, fmt.Errorf("bad data") 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 { func recursiveNodeEqual(lhs *yaml.Node, rhs *yaml.Node) bool {

View File

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