Add test coverage for multi-line option value.
[project/uci.git] / test / tests.d / 030_set
1 test_set_parsing()
2 {
3 cp ${REF_DIR}/set_parsing.data ${CONFIG_DIR}/test
4
5 assertFailWithNoReturn "${UCI_Q} set test.=val"
6 assertFailWithNoReturn "${UCI_Q} set test.section.=val"
7 assertFailWithNoReturn "${UCI_Q} set test.section.opt.=val"
8 assertFailWithNoReturn "${UCI_Q} set test.section.opt.zflk=val"
9 }
10
11 test_set_named_section()
12 {
13 touch ${CONFIG_DIR}/set
14 ${UCI} set set.section=named
15 assertSameFile ${REF_DIR}/set_named_section.result ${CHANGES_DIR}/set
16 }
17
18 test_set_nonexisting_option()
19 {
20 cp ${REF_DIR}/set_nonexisting_option.data ${CONFIG_DIR}/set
21 ${UCI} set set.section.opt=val
22 assertSameFile ${REF_DIR}/set_nonexisting_option.result ${CHANGES_DIR}/set
23 }
24
25 test_set_nonexisting_option_multiline()
26 {
27 cp ${REF_DIR}/set_nonexisting_option.data ${CONFIG_DIR}/set
28 ${UCI} set set.section.opt="Hello,\'
29 World\""
30 assertSameFile ${REF_DIR}/set_nonexisting_option_multiline.result ${CHANGES_DIR}/set
31 }
32
33 test_set_existing_option()
34 {
35 cp ${REF_DIR}/set_existing_option.data ${CONFIG_DIR}/set
36 ${UCI} set set.section.opt=val
37 assertSameFile ${REF_DIR}/set_existing_option.result ${CHANGES_DIR}/set
38 }
39
40 test_set_existing_option_multiline()
41 {
42 cp ${REF_DIR}/set_existing_option.data ${CONFIG_DIR}/set
43 ${UCI} set set.section.opt="Hello,\'
44 World\""
45 assertSameFile ${REF_DIR}/set_existing_option_multiline.result ${CHANGES_DIR}/set
46 }