From e152aab36c48466d9a65baa26d477688a2536ffb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karl=20Hasselstr=C3=B6m?= Date: Mon, 21 May 2007 21:58:38 +0100 Subject: [PATCH] Have only a single command in each test_expect_failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Otherwise, we can't know which one failed. Signed-off-by: Karl Hasselström --- t/t1000-branch-create.sh | 151 ++++++++++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 68 deletions(-) rewrite t/t1000-branch-create.sh (64%) diff --git a/t/t1000-branch-create.sh b/t/t1000-branch-create.sh dissimilarity index 64% index 58209e73..cca5504d 100755 --- a/t/t1000-branch-create.sh +++ b/t/t1000-branch-create.sh @@ -1,68 +1,83 @@ -#!/bin/sh -# -# Copyright (c) 2006 Yann Dirson -# - -test_description='Branch operations. - -Exercises the "stg branch" commands. -' - -. ./test-lib.sh - -stg init - -test_expect_failure \ - 'Try to create an stgit branch with a spurious refs/patches/ entry' \ - 'find .git -name foo | xargs rm -rf && - touch .git/refs/patches/foo && - stg branch -c foo -' - -test_expect_success \ - 'Check no part of the branch was created' \ - 'test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/patches/foo" && - ( grep foo .git/HEAD; test $? = 1 ) -' - -test_expect_failure \ - 'Try to create an stgit branch with a spurious patches/ entry' \ - 'find .git -name foo | xargs rm -rf && - touch .git/patches/foo && - stg branch -c foo -' - -test_expect_success \ - 'Check no part of the branch was created' \ - 'test "`find .git -name foo | tee /dev/stderr`" = ".git/patches/foo" && - ( grep foo .git/HEAD; test $? = 1 ) -' - -test_expect_failure \ - 'Try to create an stgit branch with an existing git branch by that name' \ - 'find .git -name foo | xargs rm -rf && - cp .git/refs/heads/master .git/refs/heads/foo && - stg branch -c foo -' - -test_expect_success \ - 'Check no part of the branch was created' \ - 'test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" && - ( grep foo .git/HEAD; test $? = 1 ) -' - - -test_expect_failure \ - 'Try to create an stgit branch with an invalid refs/heads/ entry' \ - 'find .git -name foo | xargs rm -rf && - touch .git/refs/heads/foo && - stg branch -c foo -' - -test_expect_success \ - 'Check no part of the branch was created' \ - 'test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" && - ( grep foo .git/HEAD; test $? = 1 ) -' - -test_done +#!/bin/sh +# +# Copyright (c) 2006 Yann Dirson +# + +test_description='Branch operations. + +Exercises the "stg branch" commands. +' + +. ./test-lib.sh + +stg init + +test_expect_success \ + 'Create a spurious refs/patches/ entry' ' + find .git -name foo | xargs rm -rf && + touch .git/refs/patches/foo +' + +test_expect_failure \ + 'Try to create an stgit branch with a spurious refs/patches/ entry' ' + stg branch -c foo +' + +test_expect_success \ + 'Check that no part of the branch was created' ' + test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/patches/foo" && + ( grep foo .git/HEAD; test $? = 1 ) +' + +test_expect_success \ + 'Create a spurious patches/ entry' ' + find .git -name foo | xargs rm -rf && + touch .git/patches/foo +' + +test_expect_failure \ + 'Try to create an stgit branch with a spurious patches/ entry' ' + stg branch -c foo +' + +test_expect_success \ + 'Check that no part of the branch was created' ' + test "`find .git -name foo | tee /dev/stderr`" = ".git/patches/foo" && + ( grep foo .git/HEAD; test $? = 1 ) +' + +test_expect_success \ + 'Create a git branch' ' + find .git -name foo | xargs rm -rf && + cp .git/refs/heads/master .git/refs/heads/foo +' + +test_expect_failure \ + 'Try to create an stgit branch with an existing git branch by that name' ' + stg branch -c foo +' + +test_expect_success \ + 'Check that no part of the branch was created' ' + test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" && + ( grep foo .git/HEAD; test $? = 1 ) +' + +test_expect_success \ + 'Create an invalid refs/heads/ entry' ' + find .git -name foo | xargs rm -rf && + touch .git/refs/heads/foo +' + +test_expect_failure \ + 'Try to create an stgit branch with an invalid refs/heads/ entry' ' + stg branch -c foo +' + +test_expect_success \ + 'Check that no part of the branch was created' ' + test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" && + ( grep foo .git/HEAD; test $? = 1 ) +' + +test_done -- 2.11.4.GIT