[PATCH 1/3] t7300: Basic tests for git-clean

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This tests the -d, -n, -f, -x, and -X options to git-clean.

Signed-off-by: Michael Spang <mspang@xxxxxxxxxxxx>
---
 t/t7300-clean.sh |  157 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 157 insertions(+), 0 deletions(-)
 create mode 100755 t/t7300-clean.sh

diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
new file mode 100755
index 0000000..1fb3850
--- /dev/null
+++ b/t/t7300-clean.sh
@@ -0,0 +1,157 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Michael Spang
+#
+
+test_description='git-clean basic tests'
+
+. ./test-lib.sh
+
+test_expect_success \
+    'setup' \
+    "mkdir -p src &&
+    touch src/part1.c Makefile &&
+    echo build >> .gitignore &&
+    echo *.o >> .gitignore &&
+    git-add . &&
+    git-commit -m setup &&
+    touch src/part2.c README &&
+    git-add ."
+
+test_expect_success \
+    'git-clean' \
+    "mkdir -p build docs &&
+    touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+    git-clean &&
+    test -f Makefile &&
+    test -f README &&
+    test -f src/part1.c &&
+    test -f src/part2.c &&
+    test ! -e a.out &&
+    test ! -e src/part3.c &&
+    test -f docs/manual.txt &&
+    test -f obj.o &&
+    test -f build/lib.so"
+
+test_expect_success \
+    'git-clean -n' \
+    "mkdir -p build docs &&
+    touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+    git-clean -n &&
+    test -f Makefile &&
+    test -f README &&
+    test -f src/part1.c &&
+    test -f src/part2.c &&
+    test -f a.out &&
+    test -f src/part3.c &&
+    test -f docs/manual.txt &&
+    test -f obj.o &&
+    test -f build/lib.so"
+
+test_expect_success \
+    'git-clean -d' \
+    "mkdir -p build docs &&
+    touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+    git-clean -d &&
+    test -f Makefile &&
+    test -f README &&
+    test -f src/part1.c &&
+    test -f src/part2.c &&
+    test ! -e a.out &&
+    test ! -e src/part3.c &&
+    test ! -e docs &&
+    test -f obj.o &&
+    test -f build/lib.so"
+
+test_expect_success \
+    'git-clean -x' \
+    "mkdir -p build docs &&
+    touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+    git-clean -x &&
+    test -f Makefile &&
+    test -f README &&
+    test -f src/part1.c &&
+    test -f src/part2.c &&
+    test ! -e a.out &&
+    test ! -e src/part3.c &&
+    test -f docs/manual.txt &&
+    test ! -e obj.o &&
+    test -f build/lib.so"
+
+test_expect_success \
+    'git-clean -d -x' \
+    "mkdir -p build docs &&
+    touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+    git-clean -d -x &&
+    test -f Makefile &&
+    test -f README &&
+    test -f src/part1.c &&
+    test -f src/part2.c &&
+    test ! -e a.out &&
+    test ! -e src/part3.c &&
+    test ! -e docs &&
+    test ! -e obj.o &&
+    test ! -e build"
+
+test_expect_success \
+    'git-clean -X' \
+    "mkdir -p build docs &&
+    touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+    git-clean -X &&
+    test -f Makefile &&
+    test -f README &&
+    test -f src/part1.c &&
+    test -f src/part2.c &&
+    test -f a.out &&
+    test -f src/part3.c &&
+    test -f docs/manual.txt &&
+    test ! -e obj.o &&
+    test -f build/lib.so"
+
+test_expect_success \
+    'git-clean -d -X' \
+    "mkdir -p build docs &&
+    touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+    git-clean -d -X &&
+    test -f Makefile &&
+    test -f README &&
+    test -f src/part1.c &&
+    test -f src/part2.c &&
+    test -f a.out &&
+    test -f src/part3.c &&
+    test -f docs/manual.txt &&
+    test ! -e obj.o &&
+    test ! -e build"
+
+test_expect_failure \
+    'clean.requireForce' \
+    "mkdir -p build docs &&
+    touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+    git-config clean.requireForce true &&
+    git-clean"
+
+test_expect_success \
+    'clean.requireForce and -n' \
+    "test -f Makefile &&
+    test -f README &&
+    test -f src/part1.c &&
+    test -f src/part2.c &&
+    test -f a.out &&
+    test -f src/part3.c &&
+    test -f docs/manual.txt &&
+    test -f obj.o &&
+    test -f build/lib.so"
+
+test_expect_success \
+    'clean.requireForce and -f' \
+    "git-clean -f &&
+    test -f README &&
+    test -f src/part1.c &&
+    test -f src/part2.c &&
+    test ! -e a.out &&
+    test ! -e src/part3.c &&
+    test -f docs/manual.txt &&
+    test -f obj.o &&
+    test -f build/lib.so"
+
+test_done

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]