summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2014-12-16 15:00:11 +0800
committerFelix Fietkau <nbd@openwrt.org>2014-12-18 12:38:15 +0100
commit8c09e2aefc4cbedc403e21da6e8f596081aa89cc (patch)
treec6abe3aa263471ca192db8349d9b12c62360a890
parentaa4113169d0ec107c66caaeb639f4416a0ef847f (diff)
downloaduci-8c09e2aefc4cbedc403e21da6e8f596081aa89cc.tar.gz
tests: add test coverage for `uci revert' command.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
-rw-r--r--test/references/revert_option.result3
-rw-r--r--test/references/revert_option_multiline.result2
-rw-r--r--test/references/revert_section.result0
-rw-r--r--test/tests.d/070_revert28
4 files changed, 33 insertions, 0 deletions
diff --git a/test/references/revert_option.result b/test/references/revert_option.result
new file mode 100644
index 0000000..c45a19c
--- /dev/null
+++ b/test/references/revert_option.result
@@ -0,0 +1,3 @@
+revert.SEC0='section'
+revert.SEC0.option1='"Hello,
+ World"'
diff --git a/test/references/revert_option_multiline.result b/test/references/revert_option_multiline.result
new file mode 100644
index 0000000..9982d25
--- /dev/null
+++ b/test/references/revert_option_multiline.result
@@ -0,0 +1,2 @@
+revert.SEC0='section'
+revert.SEC0.option0='value0'
diff --git a/test/references/revert_section.result b/test/references/revert_section.result
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/references/revert_section.result
diff --git a/test/tests.d/070_revert b/test/tests.d/070_revert
new file mode 100644
index 0000000..6035f6f
--- /dev/null
+++ b/test/tests.d/070_revert
@@ -0,0 +1,28 @@
+revert_test_prepare() {
+ touch ${CONFIG_DIR}/revert
+ ${UCI} set revert.SEC0=section
+ ${UCI} set revert.SEC0.option0=value0
+ ${UCI} set revert.SEC0.option1='"Hello,
+'" World\""
+}
+
+test_revert_section()
+{
+ revert_test_prepare
+ ${UCI} revert revert.SEC0
+ assertSameFile "${REF_DIR}/revert_section.result" "$CHANGES_DIR/revert"
+}
+
+test_revert_option()
+{
+ revert_test_prepare
+ ${UCI} revert revert.SEC0.option0
+ assertSameFile "${REF_DIR}/revert_option.result" "$CHANGES_DIR/revert"
+}
+
+test_revert_option_multiline()
+{
+ revert_test_prepare
+ ${UCI} revert revert.SEC0.option1
+ assertSameFile "${REF_DIR}/revert_option_multiline.result" "$CHANGES_DIR/revert"
+}