mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-13 22:38:04 +00:00
Added examples of header-preprocess needing to be turned off
This commit is contained in:
parent
b20477210f
commit
a4b60039ca
43
acceptance_tests/header-processing-off.sh
Executable file
43
acceptance_tests/header-processing-off.sh
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
setUp() {
|
||||||
|
rm test*.yml || true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
testLineCountFirstLineComment() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
#test123
|
||||||
|
abc: 123
|
||||||
|
test123: 123123
|
||||||
|
#comment
|
||||||
|
lalilu: lalilu
|
||||||
|
EOL
|
||||||
|
|
||||||
|
X=$(./yq '.lalilu | line' --header-preprocess=false < test.yml)
|
||||||
|
assertEquals "5" "$X"
|
||||||
|
}
|
||||||
|
|
||||||
|
testArrayOfDocs() {
|
||||||
|
cat >test.yml <<EOL
|
||||||
|
---
|
||||||
|
# leading comment doc 1
|
||||||
|
a: 1
|
||||||
|
---
|
||||||
|
# leading comment doc 2
|
||||||
|
a: 2
|
||||||
|
EOL
|
||||||
|
|
||||||
|
read -r -d '' expected << EOM
|
||||||
|
- # leading comment doc 1
|
||||||
|
a: 1
|
||||||
|
- # leading comment doc 2
|
||||||
|
a: 2
|
||||||
|
EOM
|
||||||
|
|
||||||
|
X=$(./yq ea '[.]' --header-preprocess=false < test.yml)
|
||||||
|
assertEquals "$expected" "$X"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
source ./scripts/shunit2
|
@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
# examples where header-preprocess is required
|
||||||
|
|
||||||
setUp() {
|
setUp() {
|
||||||
rm test*.yml || true
|
rm test*.yml || true
|
||||||
cat >test.yml <<EOL
|
cat >test.yml <<EOL
|
||||||
|
Loading…
Reference in New Issue
Block a user