mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 22:44:50 +08:00
Fixed load operator bug
This commit is contained in:
@@ -48,7 +48,7 @@ func loadYaml(filename string, decoder Decoder) (*CandidateNode, error) {
|
||||
} else {
|
||||
sequenceNode := &CandidateNode{Node: &yaml.Node{Kind: yaml.SequenceNode}}
|
||||
for doc := documents.Front(); doc != nil; doc = doc.Next() {
|
||||
sequenceNode.Node.Content = append(sequenceNode.Node.Content, doc.Value.(*CandidateNode).Node)
|
||||
sequenceNode.Node.Content = append(sequenceNode.Node.Content, unwrapDoc(doc.Value.(*CandidateNode).Node))
|
||||
}
|
||||
return sequenceNode, nil
|
||||
}
|
||||
|
||||
@@ -5,6 +5,22 @@ import (
|
||||
)
|
||||
|
||||
var loadScenarios = []expressionScenario{
|
||||
{
|
||||
skipDoc: true,
|
||||
description: "Load empty file",
|
||||
expression: `load("../../examples/empty.yaml")`,
|
||||
expected: []string{
|
||||
"D0, P[], (!!null)::\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
skipDoc: true,
|
||||
description: "Load multiple documents",
|
||||
expression: `load("../../examples/multiple_docs_small.yaml")`,
|
||||
expected: []string{
|
||||
"D0, P[], ()::- a: Easy! as one two three\n- another:\n document: here\n- - 1\n - 2\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Simple example",
|
||||
document: `{myFile: "../../examples/thing.yml"}`,
|
||||
|
||||
Reference in New Issue
Block a user