mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-14 07:08:06 +00:00
Fixed merge comment issue #919
This commit is contained in:
parent
063d40de25
commit
cb95ab1494
@ -296,6 +296,35 @@ EOM
|
|||||||
assertEquals "$expected" "$X"
|
assertEquals "$expected" "$X"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# https://github.com/mikefarah/yq/issues/919
|
||||||
|
testLeadingSeparatorDoesNotBreakCommentsOnOtherFiles() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
# a1
|
||||||
|
a: 1
|
||||||
|
# a2
|
||||||
|
EOL
|
||||||
|
|
||||||
|
cat >test2.yml <<EOL
|
||||||
|
# b1
|
||||||
|
b: 2
|
||||||
|
# b2
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
# a1
|
||||||
|
a: 1
|
||||||
|
# a2
|
||||||
|
|
||||||
|
# b1
|
||||||
|
b: 2
|
||||||
|
# b2
|
||||||
|
EOM
|
||||||
|
|
||||||
|
|
||||||
|
X=$(./yq ea 'select(fi == 0) * select(fi == 1)' test.yml test2.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
testLeadingSeperatorMultiDocEvalCommentsStripComments() {
|
testLeadingSeperatorMultiDocEvalCommentsStripComments() {
|
||||||
cat >test.yml <<EOL
|
cat >test.yml <<EOL
|
||||||
---
|
---
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
a: simple # just the best
|
# a1
|
||||||
b: [1, 2]
|
a: 1
|
||||||
c:
|
# a2
|
||||||
test: 1
|
|
@ -1,7 +1,3 @@
|
|||||||
a: other # better than the original
|
#b1
|
||||||
b: [3, 4]
|
b: 2
|
||||||
c:
|
#b2
|
||||||
toast: leave
|
|
||||||
test: 1
|
|
||||||
tell: 1
|
|
||||||
tasty.taco: cool
|
|
@ -52,7 +52,7 @@ func (e *allAtOnceEvaluator) EvaluateFiles(expression string, filenames []string
|
|||||||
|
|
||||||
var allDocuments *list.List = list.New()
|
var allDocuments *list.List = list.New()
|
||||||
for _, filename := range filenames {
|
for _, filename := range filenames {
|
||||||
reader, leadingContent, err := readStream(filename, leadingContentPreProcessing)
|
reader, leadingContent, err := readStream(filename, fileIndex == 0 && leadingContentPreProcessing)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user