public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Michael Spang <mspang@uwaterloo•ca>
To: Junio C Hamano <junkio@cox•net>
Cc: Git Mailing List <git@vger•kernel.org>
Subject: [PATCH] t7300: Basic tests for git-clean
Date: Sun, 06 May 2007 15:50:54 -0400	[thread overview]
Message-ID: <463E319E.8020304@uwaterloo.ca> (raw)
In-Reply-To: <7vlkg1bw17.fsf@assigned-by-dhcp.cox.net>

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

Signed-off-by: Michael Spang <mspang@uwaterloo•ca>
---

This replaces 1/3 and the "amend".

I guess this is the desired format? The email you sent seemed to have
spaces on one of the lines, the others had tabs so I am using tabs.


 t/t7300-clean.sh |  180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 180 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..5c31e94
--- /dev/null
+++ b/t/t7300-clean.sh
@@ -0,0 +1,180 @@
+#!/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_success 'clean.requireForce' '
+
+	git-config clean.requireForce true &&
+	! git-clean
+
+'
+
+test_expect_success 'clean.requireForce and -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 '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
-- 
1.5.2.rc1.4.g47e1

      reply	other threads:[~2007-05-06 19:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-06 18:09 [PATCH 1/3] t7300: Basic tests for git-clean Michael Spang
2007-05-06 19:08 ` [PATCH(amend)] Really run "git-clean -n" in test Michael Spang
2007-05-06 19:18   ` Junio C Hamano
2007-05-06 19:50     ` Michael Spang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=463E319E.8020304@uwaterloo.ca \
    --to=mspang@uwaterloo$(echo .)ca \
    --cc=git@vger$(echo .)kernel.org \
    --cc=junkio@cox$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox