]> arthur.barton.de Git - bup.git/commitdiff
Move clear-index tests from test.sh to test-index-clear.sh.
authorRob Browning <rlb@defaultvalue.org>
Tue, 31 Dec 2013 18:58:49 +0000 (12:58 -0600)
committerRob Browning <rlb@defaultvalue.org>
Tue, 31 Dec 2013 18:58:49 +0000 (12:58 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Makefile
t/test-index-clear.sh [new file with mode: 0755]
t/test.sh

index a3ae49e53b15b6c706b911c169c900b52e7ced28..825ef563ab961f95e9abcd07caab204546e321fa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -90,6 +90,7 @@ runtests-cmdline: all
        test -e t/tmp || mkdir t/tmp
        TMPDIR="$(test_tmp)" t/test-cat-file.sh
        TMPDIR="$(test_tmp)" t/test-compression.sh
+       TMPDIR="$(test_tmp)" t/test-index-clear.sh
        TMPDIR="$(test_tmp)" t/test-index-check-device.sh
        TMPDIR="$(test_tmp)" t/test-meta.sh
        TMPDIR="$(test_tmp)" t/test-restore-map-owner.sh
diff --git a/t/test-index-clear.sh b/t/test-index-clear.sh
new file mode 100755 (executable)
index 0000000..46bc201
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+. ./wvtest-bup.sh
+
+set -o pipefail
+
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+
+export BUP_DIR="$tmpdir/bup"
+export GIT_DIR="$tmpdir/bup"
+
+bup() { "$top/bup" "$@"; }
+
+
+WVPASS bup init
+WVPASS cd "$tmpdir"
+
+
+WVSTART "index --clear"
+WVPASS mkdir src
+WVPASS touch src/foo src/bar
+WVPASS bup index -u src
+WVPASSEQ "$(bup index -p)" "src/foo
+src/bar
+src/
+./"
+WVPASS rm src/foo
+WVPASS bup index --clear
+WVPASS bup index -u src
+expected="$(WVPASS bup index -p)" || exit $?
+WVPASSEQ "$expected" "src/bar
+src/
+./"
+
+
+WVPASS rm -rf "$tmpdir"
index 32b57d4dbaf527be277ea957afd17b925e189204..0bae1e3181e3b0f522a5414b3e9d0980f3c27eaf 100755 (executable)
--- a/t/test.sh
+++ b/t/test.sh
@@ -416,24 +416,3 @@ WVSTART "save disjoint top-level directories"
     expected="$(echo -e "$pwd_top/\n$tmp_top/" | WVPASS sort)" || exit $?
     WVPASSEQ "$actual" "$expected"
 ) || exit $?
-
-WVSTART "clear-index"
-D=clear-index.tmp
-export BUP_DIR="$TOP/$D/.bup"
-WVPASS force-delete $TOP/$D
-WVPASS mkdir $TOP/$D
-WVPASS bup init
-WVPASS touch $TOP/$D/foo
-WVPASS touch $TOP/$D/bar
-WVPASS bup index -u $D
-WVPASSEQ "$(bup index -p)" "$D/foo
-$D/bar
-$D/
-./"
-WVPASS rm $TOP/$D/foo
-WVPASS bup index --clear
-WVPASS bup index -u $TOP/$D
-expected="$(WVPASS bup index -p)" || exit $?
-WVPASSEQ "$expected" "$D/bar
-$D/
-./"