Skip to content

Commit

Permalink
Merge branch 'fc/show-non-empty-errors-in-test'
Browse files Browse the repository at this point in the history
* fc/show-non-empty-errors-in-test:
  test: test_must_be_empty helper
  • Loading branch information
Junio C Hamano committed Jun 20, 2013
2 parents 0846fe1 + ca8d148 commit 01c0615
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 53 deletions.
46 changes: 23 additions & 23 deletions t/t0040-parse-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ EOF

test_expect_success 'test help' '
test_must_fail test-parse-options -h > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_i18ncmp expect output
'

Expand All @@ -75,7 +75,7 @@ check() {
shift &&
sed "s/^$what .*/$what $expect/" <expect.template >expect &&
test-parse-options $* >output 2>output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
}

Expand All @@ -86,7 +86,7 @@ check_i18n() {
shift &&
sed "s/^$what .*/$what $expect/" <expect.template >expect &&
test-parse-options $* >output 2>output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_i18ncmp expect output
}

Expand All @@ -99,7 +99,7 @@ check_unknown() {
esac &&
cat expect.err >>expect &&
test_must_fail test-parse-options $* >output 2>output.err &&
test ! -s output &&
test_must_be_empty output &&
test_cmp expect output.err
}

Expand All @@ -112,7 +112,7 @@ check_unknown_i18n() {
esac &&
cat expect.err >>expect &&
test_must_fail test-parse-options $* >output 2>output.err &&
test ! -s output &&
test_must_be_empty output &&
test_i18ncmp expect output.err
}

Expand Down Expand Up @@ -149,7 +149,7 @@ test_expect_success 'short options' '
test-parse-options -s123 -b -i 1729 -b -vv -n -F my.file \
> output 2> output.err &&
test_cmp expect output &&
test ! -s output.err
test_must_be_empty output.err
'

cat > expect << EOF
Expand All @@ -168,7 +168,7 @@ test_expect_success 'long options' '
test-parse-options --boolean --integer 1729 --boolean --string2=321 \
--verbose --verbose --no-dry-run --abbrev=10 --file fi.le\
--obsolete > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand Down Expand Up @@ -199,7 +199,7 @@ EOF
test_expect_success 'intermingled arguments' '
test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
> output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand All @@ -217,13 +217,13 @@ EOF

test_expect_success 'unambiguously abbreviated option' '
test-parse-options --int 2 --boolean --no-bo > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

test_expect_success 'unambiguously abbreviated option with "="' '
test-parse-options --int=2 > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand All @@ -246,7 +246,7 @@ EOF

test_expect_success 'non ambiguous option (after two options it abbreviates)' '
test-parse-options --st 123 > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand All @@ -256,7 +256,7 @@ EOF

test_expect_success 'detect possible typos' '
test_must_fail test-parse-options -boolean > output 2> output.err &&
test ! -s output &&
test_must_be_empty output &&
test_cmp typo.err output.err
'

Expand All @@ -266,7 +266,7 @@ EOF

test_expect_success 'detect possible typos' '
test_must_fail test-parse-options -ambiguous > output 2> output.err &&
test ! -s output &&
test_must_be_empty output &&
test_cmp typo.err output.err
'

Expand All @@ -285,7 +285,7 @@ EOF

test_expect_success 'keep some options as arguments' '
test-parse-options --quux > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand All @@ -305,7 +305,7 @@ EOF
test_expect_success 'OPT_DATE() and OPT_SET_PTR() work' '
test-parse-options -t "1970-01-01 00:00:01 +0000" --default-string \
foo -q > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand All @@ -324,7 +324,7 @@ EOF

test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '
test-parse-options --length=four -b -4 > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand Down Expand Up @@ -352,13 +352,13 @@ EOF

test_expect_success 'OPT_BIT() and OPT_SET_INT() work' '
test-parse-options --set23 -bbbbb --no-or4 > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

test_expect_success 'OPT_NEGBIT() and OPT_SET_INT() work' '
test-parse-options --set23 -bbbbb --neg-or4 > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand All @@ -376,19 +376,19 @@ EOF

test_expect_success 'OPT_BIT() works' '
test-parse-options -bb --or4 > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

test_expect_success 'OPT_NEGBIT() works' '
test-parse-options -bb --no-neg-or4 > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' '
test-parse-options + + + + + + > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand All @@ -406,7 +406,7 @@ EOF

test_expect_success 'OPT_NUMBER_CALLBACK() works' '
test-parse-options -12345 > output 2> output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand All @@ -424,7 +424,7 @@ EOF

test_expect_success 'negation of OPT_NONEG flags is not ambiguous' '
test-parse-options --no-ambig >output 2>output.err &&
test ! -s output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'

Expand Down
2 changes: 1 addition & 1 deletion t/t3400-rebase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ test_expect_success 'default to @{upstream} when upstream arg is missing' '
test_expect_success 'rebase -q is quiet' '
git checkout -b quiet topic &&
git rebase -q master >output.out 2>&1 &&
test ! -s output.out
test_must_be_empty output.out
'

test_expect_success 'Rebase a commit that sprinkles CRs in' '
Expand Down
10 changes: 5 additions & 5 deletions t/t3903-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,17 @@ test_expect_success 'apply -q is quiet' '
echo foo > file &&
git stash &&
git stash apply -q > output.out 2>&1 &&
test ! -s output.out
test_must_be_empty output.out
'

test_expect_success 'save -q is quiet' '
git stash save --quiet > output.out 2>&1 &&
test ! -s output.out
test_must_be_empty output.out
'

test_expect_success 'pop -q is quiet' '
git stash pop -q > output.out 2>&1 &&
test ! -s output.out
test_must_be_empty output.out
'

test_expect_success 'pop -q --index works and is quiet' '
Expand All @@ -219,13 +219,13 @@ test_expect_success 'pop -q --index works and is quiet' '
git stash save --quiet &&
git stash pop -q --index > output.out 2>&1 &&
test foo = "$(git show :file)" &&
test ! -s output.out
test_must_be_empty output.out
'

test_expect_success 'drop -q is quiet' '
git stash &&
git stash drop -q > output.out 2>&1 &&
test ! -s output.out
test_must_be_empty output.out
'

test_expect_success 'stash -k' '
Expand Down
26 changes: 13 additions & 13 deletions t/t5521-pull-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,66 +15,66 @@ test_expect_success 'git pull -q' '
mkdir clonedq &&
(cd clonedq && git init &&
git pull -q "../parent" >out 2>err &&
test ! -s err &&
test ! -s out)
test_must_be_empty err &&
test_must_be_empty out)
'

test_expect_success 'git pull -q --rebase' '
mkdir clonedqrb &&
(cd clonedqrb && git init &&
git pull -q --rebase "../parent" >out 2>err &&
test ! -s err &&
test ! -s out &&
test_must_be_empty err &&
test_must_be_empty out &&
git pull -q --rebase "../parent" >out 2>err &&
test ! -s err &&
test ! -s out)
test_must_be_empty err &&
test_must_be_empty out)
'

test_expect_success 'git pull' '
mkdir cloned &&
(cd cloned && git init &&
git pull "../parent" >out 2>err &&
test -s err &&
test ! -s out)
test_must_be_empty out)
'

test_expect_success 'git pull --rebase' '
mkdir clonedrb &&
(cd clonedrb && git init &&
git pull --rebase "../parent" >out 2>err &&
test -s err &&
test ! -s out)
test_must_be_empty out)
'

test_expect_success 'git pull -v' '
mkdir clonedv &&
(cd clonedv && git init &&
git pull -v "../parent" >out 2>err &&
test -s err &&
test ! -s out)
test_must_be_empty out)
'

test_expect_success 'git pull -v --rebase' '
mkdir clonedvrb &&
(cd clonedvrb && git init &&
git pull -v --rebase "../parent" >out 2>err &&
test -s err &&
test ! -s out)
test_must_be_empty out)
'

test_expect_success 'git pull -v -q' '
mkdir clonedvq &&
(cd clonedvq && git init &&
git pull -v -q "../parent" >out 2>err &&
test ! -s out &&
test ! -s err)
test_must_be_empty out &&
test_must_be_empty err)
'

test_expect_success 'git pull -q -v' '
mkdir clonedqv &&
(cd clonedqv && git init &&
git pull -q -v "../parent" >out 2>err &&
test ! -s out &&
test_must_be_empty out &&
test -s err)
'

Expand Down
2 changes: 1 addition & 1 deletion t/t5702-clone-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test_expect_success 'clone -o' '
test_expect_success 'redirected clone' '
git clone "file://$(pwd)/parent" clone-redirected >out 2>err &&
test ! -s err
test_must_be_empty err
'
test_expect_success 'redirected clone -v' '
Expand Down
2 changes: 1 addition & 1 deletion t/t7102-reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ test_expect_success 'disambiguation (1)' '
test_must_fail git diff --quiet -- secondfile &&
test -z "$(git diff --cached --name-only)" &&
test -f secondfile &&
test ! -s secondfile
test_must_be_empty secondfile
'

Expand Down
6 changes: 3 additions & 3 deletions t/t7400-submodule-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ test_expect_success 'submodule add' '
(
cd addtest &&
git submodule add -q "$submodurl" submod >actual &&
test ! -s actual &&
test_must_be_empty actual &&
echo "gitdir: ../.git/modules/submod" >expect &&
test_cmp expect submod/.git &&
(
Expand Down Expand Up @@ -308,7 +308,7 @@ test_expect_success 'update should work when path is an empty dir' '
mkdir init &&
git submodule update -q >update.out &&
test ! -s update.out &&
test_must_be_empty update.out &&
inspect init &&
test_cmp expect head-sha1
Expand Down Expand Up @@ -696,7 +696,7 @@ test_expect_success 'submodule add --name allows to replace a submodule with ano
rm -rf repo &&
git rm repo &&
git submodule add -q --name repo_new "$submodurl/bare.git" repo >actual &&
test ! -s actual &&
test_must_be_empty actual &&
echo "gitdir: ../.git/modules/submod" >expect &&
test_cmp expect submod/.git &&
(
Expand Down
Loading

0 comments on commit 01c0615

Please sign in to comment.