From 5be60078c935ed08ee8eb5a32680bdfb6bb5bdf3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 2 Jul 2007 22:52:14 -0700 Subject: Rewrite "git-frotz" to "git frotz" This uses the remove-dashes target to replace "git-frotz" to "git frotz". Signed-off-by: Junio C Hamano --- t/t4113-apply-ending.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 't/t4113-apply-ending.sh') diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh index 7fd0cf62ec..1c6bec044a 100755 --- a/t/t4113-apply-ending.sh +++ b/t/t4113-apply-ending.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Catalin Marinas # -test_description='git-apply trying to add an ending line. +test_description='git apply trying to add an ending line. ' . ./test-lib.sh @@ -25,12 +25,12 @@ echo 'b' >>file echo 'c' >>file test_expect_success setup \ - 'git-update-index --add file' + 'git update-index --add file' # test test_expect_failure 'apply at the end' \ - 'git-apply --index test-patch' + 'git apply --index test-patch' cat >test-patch <<\EOF diff a/file b/file @@ -45,9 +45,9 @@ EOF echo >file 'a b c' -git-update-index file +git update-index file test_expect_failure 'apply at the beginning' \ - 'git-apply --index test-patch' + 'git apply --index test-patch' test_done -- cgit v1.2.3 From 41ac414ea2bef81af94474cbef25a38868b4788e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 1 Feb 2008 01:50:53 -0800 Subject: Sane use of test_expect_failure Originally, test_expect_failure was designed to be the opposite of test_expect_success, but this was a bad decision. Most tests run a series of commands that leads to the single command that needs to be tested, like this: test_expect_{success,failure} 'test title' ' setup1 && setup2 && setup3 && what is to be tested ' And expecting a failure exit from the whole sequence misses the point of writing tests. Your setup$N that are supposed to succeed may have failed without even reaching what you are trying to test. The only valid use of test_expect_failure is to check a trivial single command that is expected to fail, which is a minority in tests of Porcelain-ish commands. This large-ish patch rewrites all uses of test_expect_failure to use test_expect_success and rewrites the condition of what is tested, like this: test_expect_success 'test title' ' setup1 && setup2 && setup3 && ! this command should fail ' test_expect_failure is redefined to serve as a reminder that that test *should* succeed but due to a known breakage in git it currently does not pass. So if git-foo command should create a file 'bar' but you discovered a bug that it doesn't, you can write a test like this: test_expect_failure 'git-foo should create bar' ' rm -f bar && git foo && test -f bar ' This construct acts similar to test_expect_success, but instead of reporting "ok/FAIL" like test_expect_success does, the outcome is reported as "FIXED/still broken". Signed-off-by: Junio C Hamano --- t/t4113-apply-ending.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't/t4113-apply-ending.sh') diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh index 1c6bec044a..d741039882 100755 --- a/t/t4113-apply-ending.sh +++ b/t/t4113-apply-ending.sh @@ -29,8 +29,8 @@ test_expect_success setup \ # test -test_expect_failure 'apply at the end' \ - 'git apply --index test-patch' +test_expect_success 'apply at the end' \ + '! git apply --index test-patch' cat >test-patch <<\EOF diff a/file b/file @@ -47,7 +47,7 @@ b c' git update-index file -test_expect_failure 'apply at the beginning' \ - 'git apply --index test-patch' +test_expect_success 'apply at the beginning' \ + '! git apply --index test-patch' test_done -- cgit v1.2.3 From d492b31cafe9aa5ce001b1d48815f4c0bb40d01a Mon Sep 17 00:00:00 2001 From: Stephan Beyer Date: Sat, 12 Jul 2008 17:47:52 +0200 Subject: t/: Use "test_must_fail git" instead of "! git" This patch changes every occurrence of "! git" -- with the meaning that a git call has to gracefully fail -- into "test_must_fail git". This is useful to - make sure the test does not fail because of a signal, e.g. SIGSEGV, and - advertise the use of "test_must_fail" for new tests. Signed-off-by: Stephan Beyer Signed-off-by: Junio C Hamano --- t/t4113-apply-ending.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't/t4113-apply-ending.sh') diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh index d741039882..66fa51591e 100755 --- a/t/t4113-apply-ending.sh +++ b/t/t4113-apply-ending.sh @@ -30,7 +30,7 @@ test_expect_success setup \ # test test_expect_success 'apply at the end' \ - '! git apply --index test-patch' + 'test_must_fail git apply --index test-patch' cat >test-patch <<\EOF diff a/file b/file @@ -48,6 +48,6 @@ c' git update-index file test_expect_success 'apply at the beginning' \ - '! git apply --index test-patch' + 'test_must_fail git apply --index test-patch' test_done -- cgit v1.2.3