[OpenWrt-Devel] [PATCH 1/2] tests: add test coverage for comment lines within batch commands.

yszhou4tech at gmail.com yszhou4tech at gmail.com
Thu Apr 9 09:48:46 EDT 2015


From: Yousong Zhou <yszhou4tech at gmail.com>


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

diff --git a/test/references/batch_comments.result b/test/references/batch_comments.result
new file mode 100644
index 0000000..c726bad
--- /dev/null
+++ b/test/references/batch_comments.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
index 49d15e4..40f473b 100644
--- a/test/tests.d/060_batch
+++ b/test/tests.d/060_batch
@@ -15,3 +15,29 @@ EOF
 	assertSameFile "${REF_DIR}/batch_set.result" "${CONFIG_DIR}/batch_set"
 }
 
+test_batch_comments()
+{
+	touch ${CONFIG_DIR}/batch_comments
+
+        ${UCI} batch <<EOF
+# first line comment
+set batch_comments.SEC0='section'
+set batch_comments.SEC0.option0='value0'
+
+# two consecutive blank lines
+# two consecutive blank lines
+
+
+set batch_comments.SEC0.option1='"Hello,
+'"  World\""
+set batch_comments.SEC1='section'
+set batch_comments.SEC1.option0="value1"
+
+ 	 # comment line starts with spaces.
+
+commit
+# last line comment
+EOF
+
+	assertSameFile "${REF_DIR}/batch_comments.result" "${CONFIG_DIR}/batch_comments"
+}
-- 
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