ucimap: properly test bool interpretation
[project/uci.git] / test / tests.d / 020_get
1 test_get_parsing()
2 {
3 cp ${REF_DIR}/get_parsing.data ${CONFIG_DIR}/test
4
5 assertFailWithNoReturn "${UCI} get test."
6 assertFailWithNoReturn "${UCI} get test.section."
7 assertFailWithNoReturn "${UCI} get test.section.opt."
8 assertFailWithNoReturn "${UCI} get test.section.opt.val."
9 assertFailWithNoReturn "${UCI} get test.section.opt.val.qsdf.qsd"
10 assertFailWithNoReturn "${UCI} get test.section.opt.valqsqsd"
11 }
12
13 test_get_section_index_parsing()
14 {
15 cp ${REF_DIR}/get_parsing.data ${CONFIG_DIR}/test
16
17 assertFailWithNoReturn "${UCI} get test.@"
18 assertFailWithNoReturn "${UCI} get test.@zer."
19 assertFailWithNoReturn "${UCI} get test.@."
20 assertFailWithNoReturn "${UCI} get test.@zer[1]"
21 assertFailWithNoReturn "${UCI} get test.@.opt"
22 assertFailWithNoReturn "${UCI} get test.@[28]"
23 assertFailWithNoReturn "${UCI} get test.@[1]."
24 assertFailWithNoReturn "${UCI} get test.@[1].val."
25 }
26
27 test_get_option()
28 {
29 cp ${REF_DIR}/get.data ${CONFIG_DIR}/test
30 value=$($UCI get test.section.opt)
31 assertEquals 'val' "$value"
32 }
33
34 test_get_section()
35 {
36 cp ${REF_DIR}/get.data ${CONFIG_DIR}/test
37 type=$($UCI get test.section)
38 assertEquals 'type' "$type"
39 }