ad19264a83f0b3516255438bac0e7155c4c70d0d
[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_Q} get test."
6 assertFailWithNoReturn "${UCI_Q} get test.section."
7 assertFailWithNoReturn "${UCI_Q} get test.section.opt."
8 assertFailWithNoReturn "${UCI_Q} get test.section.opt.val."
9 assertFailWithNoReturn "${UCI_Q} get test.section.opt.val.qsdf.qsd"
10 assertFailWithNoReturn "${UCI_Q} 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_Q} get test.@"
18 assertFailWithNoReturn "${UCI_Q} get test.@zer."
19 assertFailWithNoReturn "${UCI_Q} get test.@."
20 assertFailWithNoReturn "${UCI_Q} get test.@zer[1]"
21 assertFailWithNoReturn "${UCI_Q} get test.@.opt"
22 assertFailWithNoReturn "${UCI_Q} get test.@[28]"
23 assertFailWithNoReturn "${UCI_Q} get test.@[1]."
24 assertFailWithNoReturn "${UCI_Q} 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 }