[augeas-devel] [PATCH 4/4] Migrate tests from test-mv.sh into run.tests
lutter at redhat.com
lutter at redhat.com
Fri Jul 22 22:37:43 UTC 2011
From: David Lutterkort <lutter at redhat.com>
---
tests/Makefile.am | 2 +-
tests/run.tests | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/test-mv.sh | 48 ------------------------------------------------
3 files changed, 53 insertions(+), 49 deletions(-)
delete mode 100755 tests/test-mv.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 546ab62..24a27c4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -134,7 +134,7 @@ check_SCRIPTS = \
test-interpreter.sh \
$(lens_tests) \
test-get.sh test-augtool.sh \
- test-put-symlink.sh test-save-empty.sh test-mv.sh \
+ test-put-symlink.sh test-save-empty.sh \
test-bug-1.sh test-idempotent.sh test-preserve.sh \
test-events-saved.sh test-save-mode.sh test-unlink-error.sh \
test-augtool-empty-line.sh test-augtool-modify-root.sh
diff --git a/tests/run.tests b/tests/run.tests
index 9e49d92..129d52b 100644
--- a/tests/run.tests
+++ b/tests/run.tests
@@ -142,6 +142,58 @@ test mv-into-multiple -1 EMMATCH
test mv-multiple -1 EMMATCH
mv /augeas/version/save/* /files
+test mv-tree1 3
+ set /a/b/c value
+ mv /a/b/c /x
+ print /*[ label() != 'augeas' and label() != 'files']
+prints
+ /a
+ /a/b
+ /x = "value"
+
+test mv-tree2 3
+ set /a/b/c value
+ mv /a/b/c /a/x
+ print /*[ label() != 'augeas' and label() != 'files']
+prints
+ /a
+ /a/b
+ /a/x = "value"
+
+test mv-tree3 3
+ set /a/b/c value
+ mv /a/b/c /x/y
+ print /*[ label() != 'augeas' and label() != 'files']
+prints
+ /a
+ /a/b
+ /x
+ /x/y = "value"
+
+test mv-tree4 -1 EMVDESC
+ set /a/b/c value
+ mv /a/b/c /a/b/c/d
+ print /*[ label() != 'augeas' and label() != 'files']
+
+test mv-tree5 3
+ set /a/b/c value
+ mv /a/b/c /a/b/d
+ print /*[ label() != 'augeas' and label() != 'files']
+prints
+ /a
+ /a/b
+ /a/b/d = "value"
+
+test mv-tree6 3
+ set /a/b/c value
+ mv /a /x/y
+ print /*[ label() != 'augeas' and label() != 'files']
+prints
+ /x
+ /x/y
+ /x/y/b
+ /x/y/b/c = "value"
+
#
# test set
#
diff --git a/tests/test-mv.sh b/tests/test-mv.sh
deleted file mode 100755
index d208f4a..0000000
--- a/tests/test-mv.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#! /bin/bash
-
-aug_mv() {
-opts='--nostdinc -r /dev/null'
-(augtool $opts | grep -v '/augeas\|/files\|augtool' | tr '\n' ' ') 2>&1 <<EOF
-set /a/b/c value
-mv $1 $2
-print
-EOF
-}
-
-assert_eq() {
- msg=$1
- if [ "$ACT" != "$EXP" ] ; then
- echo "Failed: aug_mv $msg"
- echo "Expected: <$EXP>"
- echo "Actual : <$ACT>"
- exit 1
- fi
-
-}
-
-ACT=$(aug_mv /a/b/c /x)
-EXP='/a /a/b /x = "value" '
-assert_eq /x
-
-ACT=$(aug_mv /a/b/c /x/y)
-EXP='/a /a/b /x /x/y = "value" '
-assert_eq /x/y
-
-ACT=$(aug_mv /a/b/c /a/x)
-EXP='/a /a/b /a/x = "value" '
-assert_eq /a/x
-
-# Check that we don't move into a descendant
-ACT=$(aug_mv /a/b/c /a/b/c/d)
-EXP='error: Cannot move node into its descendant
-error: destination /a/b/c/d is a descendant of /a/b/c
-/a /a/b /a/b/c = "value" /a/b/c/d '
-assert_eq /a/b/c/d
-
-ACT=$(aug_mv /a/b/c /a/b/d)
-EXP='/a /a/b /a/b/d = "value" '
-assert_eq /a/b/d
-
-ACT=$(aug_mv /a /x/y)
-EXP='/x /x/y /x/y/b /x/y/b/c = "value" '
-assert_eq "/a to /x/y"
--
1.7.6
More information about the augeas-devel
mailing list