[OpenWrt-Devel] [PATCH v2 08/16] tests: add test coverage for `uci batch' command.

Yousong Zhou yszhou4tech at gmail.com
Tue Dec 16 02:00:10 EST 2014


Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 test/references/batch_set.result |    9 +++++++++
 test/tests.d/060_batch           |   17 +++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 test/references/batch_set.result
 create mode 100644 test/tests.d/060_batch

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"
+}
+
-- 
1.7.10.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list