summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2014-12-16 15:00:10 +0800
committerFelix Fietkau <nbd@openwrt.org>2014-12-18 12:38:15 +0100
commitaa4113169d0ec107c66caaeb639f4416a0ef847f (patch)
tree022d6487ae30a1356ffe264445e43e225240b2cd
parent8dd9e03ef277f0078b1a75e6c7d82e9d42f35c2f (diff)
downloaduci-aa4113169d0ec107c66caaeb639f4416a0ef847f.tar.gz
tests: add test coverage for `uci batch' command.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
-rw-r--r--test/references/batch_set.result9
-rw-r--r--test/tests.d/060_batch17
2 files changed, 26 insertions, 0 deletions
diff --git a/test/references/batch_set.result b/test/references/batch_set.result
new file mode 100644
index 0000000..c726bad
--- /dev/null
+++ b/test/references/batch_set.result
@@ -0,0 +1,9 @@
+
+config section 'SEC0'
+ option option0 'value0'
+ option option1 '"Hello,
+ World"'
+
+config section 'SEC1'
+ option option0 'value1'
+
diff --git a/test/tests.d/060_batch b/test/tests.d/060_batch
new file mode 100644
index 0000000..49d15e4
--- /dev/null
+++ b/test/tests.d/060_batch
@@ -0,0 +1,17 @@
+test_batch_set()
+{
+ touch ${CONFIG_DIR}/batch_set
+
+ ${UCI} batch <<EOF
+set batch_set.SEC0='section'
+set batch_set.SEC0.option0='value0'
+set batch_set.SEC0.option1='"Hello,
+'" World\""
+set batch_set.SEC1='section'
+set batch_set.SEC1.option0="value1"
+
+EOF
+ ${UCI} commit
+ assertSameFile "${REF_DIR}/batch_set.result" "${CONFIG_DIR}/batch_set"
+}
+