2021-07-18 06:55:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
setUp() {
|
|
|
|
cat >test.yml <<EOL
|
|
|
|
---
|
|
|
|
a: test
|
|
|
|
EOL
|
|
|
|
}
|
|
|
|
|
|
|
|
testLeadingSeperatorPipeIntoEvalSeq() {
|
2021-07-18 07:05:12 +00:00
|
|
|
X=$(./yq e - < test.yml)
|
2021-07-18 06:55:08 +00:00
|
|
|
expected=$(cat test.yml)
|
|
|
|
assertEquals "$expected" "$X"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
testLeadingSeperatorEvalSeq() {
|
|
|
|
X=$(./yq e test.yml)
|
|
|
|
expected=$(cat test.yml)
|
|
|
|
assertEquals "$expected" "$X"
|
|
|
|
}
|
|
|
|
|
|
|
|
testLeadingSeperatorPipeIntoEvalAll() {
|
2021-07-18 07:05:12 +00:00
|
|
|
X=$(./yq ea - < test.yml)
|
2021-07-18 06:55:08 +00:00
|
|
|
expected=$(cat test.yml)
|
|
|
|
assertEquals "$expected" "$X"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
testLeadingSeperatorEvalAll() {
|
|
|
|
X=$(./yq ea test.yml)
|
|
|
|
expected=$(cat test.yml)
|
|
|
|
assertEquals "$expected" "$X"
|
|
|
|
}
|
|
|
|
|
|
|
|
testLeadingSeperatorMultiDocEval() {
|
|
|
|
read -r -d '' expected << EOM
|
|
|
|
---
|
|
|
|
a: test
|
|
|
|
---
|
|
|
|
version: 3
|
|
|
|
application: MyApp
|
|
|
|
EOM
|
|
|
|
|
|
|
|
|
|
|
|
X=$(./yq e '.' test.yml examples/order.yaml)
|
|
|
|
assertEquals "$expected" "$X"
|
|
|
|
}
|
|
|
|
|
|
|
|
testLeadingSeperatorMultiDocEvalAll() {
|
|
|
|
read -r -d '' expected << EOM
|
|
|
|
---
|
|
|
|
a: test
|
|
|
|
---
|
|
|
|
version: 3
|
|
|
|
application: MyApp
|
|
|
|
EOM
|
|
|
|
|
|
|
|
|
|
|
|
X=$(./yq ea '.' test.yml examples/order.yaml)
|
|
|
|
assertEquals "$expected" "$X"
|
|
|
|
}
|
|
|
|
|
|
|
|
source ./scripts/shunit2
|