From f03004e2c26efcd6b172a915e8e0d2f9a7cb064b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karl=20Hasselstr=C3=B6m?= Date: Sun, 6 Jul 2008 18:09:08 +0200 Subject: [PATCH] Test for specific exit code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When a command is supposed to fail in a test, test for the exact error code we're expecting, not just that it's non-zero. This makes sure e.g. that a command that's supposed to fail doesn't do so with an unhandled exception. Signed-off-by: Karl Hasselström --- t/README | 6 +++--- t/t0001-subdir-branches.sh | 12 ++++++------ t/t0002-status.sh | 2 +- t/t1000-branch-create.sh | 8 ++++---- t/t1001-branch-rename.sh | 2 +- t/t1002-branch-clone.sh | 2 +- t/t1200-push-modified.sh | 2 +- t/t1202-push-undo.sh | 4 ++-- t/t1203-push-conflict.sh | 4 ++-- t/t1205-push-subdir.sh | 4 ++-- t/t1301-repair.sh | 2 +- t/t1302-repair-interop.sh | 4 ++-- t/t1400-patch-history.sh | 2 +- t/t1501-sink.sh | 2 +- t/t1600-delete-one.sh | 4 ++-- t/t1601-delete-many.sh | 2 +- t/t2000-sync.sh | 4 ++-- t/t2101-pull-policy-pull.sh | 2 +- t/t2200-rebase.sh | 2 +- t/t2500-clean.sh | 2 +- t/t2900-rename.sh | 8 ++++---- t/t3000-dirty-merge.sh | 2 +- t/t4000-upgrade.sh | 2 +- t/test-lib.sh | 24 ++++++++++++++++++++++++ 24 files changed, 66 insertions(+), 42 deletions(-) diff --git a/t/README b/t/README index 77f0b6c..757f810 100644 --- a/t/README +++ b/t/README @@ -163,9 +163,9 @@ library for your script to use. yields success, test is considered a failure. This should _not_ be used for tests that succeed when their - commands fail -- use test_expect_success and shell negation (!) for - that. test_expect_failure is for cases when a test is known to be - broken. + commands fail -- use test_expect_success and one of general_error, + command_error, and conflict for that. test_expect_failure is for + cases when a test is known to be broken. - test_debug