Skip to content

Commit a4b6003

Browse files
committed
Added examples of header-preprocess needing to be turned off
1 parent b204772 commit a4b6003

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
setUp() {
4+
rm test*.yml || true
5+
6+
}
7+
8+
testLineCountFirstLineComment() {
9+
cat >test.yml <<EOL
10+
#test123
11+
abc: 123
12+
test123: 123123
13+
#comment
14+
lalilu: lalilu
15+
EOL
16+
17+
X=$(./yq '.lalilu | line' --header-preprocess=false < test.yml)
18+
assertEquals "5" "$X"
19+
}
20+
21+
testArrayOfDocs() {
22+
cat >test.yml <<EOL
23+
---
24+
# leading comment doc 1
25+
a: 1
26+
---
27+
# leading comment doc 2
28+
a: 2
29+
EOL
30+
31+
read -r -d '' expected << EOM
32+
- # leading comment doc 1
33+
a: 1
34+
- # leading comment doc 2
35+
a: 2
36+
EOM
37+
38+
X=$(./yq ea '[.]' --header-preprocess=false < test.yml)
39+
assertEquals "$expected" "$X"
40+
41+
}
42+
43+
source ./scripts/shunit2

acceptance_tests/leading-seperator.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
4+
# examples where header-preprocess is required
5+
36
setUp() {
47
rm test*.yml || true
58
cat >test.yml <<EOL

0 commit comments

Comments
 (0)