tests: add test coverage for comment lines within batch commands.
[oweals/uci.git] / test / tests.d / 060_batch
1 test_batch_set()
2 {
3         touch ${CONFIG_DIR}/batch_set
4
5         ${UCI} batch <<EOF
6 set batch_set.SEC0='section'
7 set batch_set.SEC0.option0='value0'
8 set batch_set.SEC0.option1='"Hello,
9 '"  World\""
10 set batch_set.SEC1='section'
11 set batch_set.SEC1.option0="value1"
12
13 EOF
14         ${UCI} commit
15         assertSameFile "${REF_DIR}/batch_set.result" "${CONFIG_DIR}/batch_set"
16 }
17
18 test_batch_comments()
19 {
20         touch ${CONFIG_DIR}/batch_comments
21
22         ${UCI} batch <<EOF
23 # first line comment
24 set batch_comments.SEC0='section'
25 set batch_comments.SEC0.option0='value0'
26
27 # two consecutive blank lines
28 # two consecutive blank lines
29
30
31 set batch_comments.SEC0.option1='"Hello,
32 '"  World\""
33 set batch_comments.SEC1='section'
34 set batch_comments.SEC1.option0="value1"
35
36          # comment line starts with spaces.
37
38 commit
39 # last line comment
40 EOF
41
42         assertSameFile "${REF_DIR}/batch_comments.result" "${CONFIG_DIR}/batch_comments"
43 }