summaryrefslogtreecommitdiffstats
path: root/test/tests.d/030_set
blob: db3c259c2695f717354728189bd7ae5a8df43981 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
test_set_parsing()
{
	cp ${REF_DIR}/set_parsing.data ${CONFIG_DIR}/test

	assertFailWithNoReturn "${UCI_Q} set test.=val"
	assertFailWithNoReturn "${UCI_Q} set test.section.=val"
	assertFailWithNoReturn "${UCI_Q} set test.section.opt.=val"
	assertFailWithNoReturn "${UCI_Q} set test.section.opt.zflk=val"
}

test_set_named_section()
{
	touch ${CONFIG_DIR}/set
	${UCI} set set.section=named
	assertSameFile ${REF_DIR}/set_named_section.result ${CHANGES_DIR}/set
}

test_set_nonexisting_option()
{
	cp ${REF_DIR}/set_nonexisting_option.data ${CONFIG_DIR}/set
	${UCI} set set.section.opt=val
	assertSameFile ${REF_DIR}/set_nonexisting_option.result ${CHANGES_DIR}/set
}

test_set_nonexisting_option_multiline()
{
	cp ${REF_DIR}/set_nonexisting_option.data ${CONFIG_DIR}/set
	${UCI} set set.section.opt="Hello,\'
World\""
	assertSameFile ${REF_DIR}/set_nonexisting_option_multiline.result ${CHANGES_DIR}/set
}

test_set_existing_option()
{
	cp ${REF_DIR}/set_existing_option.data ${CONFIG_DIR}/set
	${UCI} set set.section.opt=val
	assertSameFile ${REF_DIR}/set_existing_option.result ${CHANGES_DIR}/set
}

test_set_existing_option_multiline()
{
	cp ${REF_DIR}/set_existing_option.data ${CONFIG_DIR}/set
	${UCI} set set.section.opt="Hello,\'
World\""
	assertSameFile ${REF_DIR}/set_existing_option_multiline.result ${CHANGES_DIR}/set
}