tests: add test coverage for comment lines within batch commands.
authorYousong Zhou <yszhou4tech@gmail.com>
Thu, 9 Apr 2015 13:48:46 +0000 (21:48 +0800)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 9 Apr 2015 14:55:03 +0000 (16:55 +0200)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
test/references/batch_comments.result [new file with mode: 0644]
test/tests.d/060_batch

diff --git a/test/references/batch_comments.result b/test/references/batch_comments.result
new file mode 100644 (file)
index 0000000..c726bad
--- /dev/null
@@ -0,0 +1,9 @@
+
+config section 'SEC0'
+       option option0 'value0'
+       option option1 '"Hello,
+  World"'
+
+config section 'SEC1'
+       option option0 'value1'
+
index 49d15e4e471939e4f8123ecfcf9f14b5d64fc412..40f473be47c963b37160ea68c772828f2f74625b 100644 (file)
@@ -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"
+}