summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/t0040-parse-options.sh2
-rwxr-xr-xt/t0041-usage.sh107
-rwxr-xr-xt/t3404-rebase-interactive.sh6
3 files changed, 110 insertions, 5 deletions
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 0c2fc81..04d474c 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -291,7 +291,7 @@ test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '
test_expect_success 'OPT_CALLBACK() and callback errors work' '
test_must_fail test-parse-options --no-length >output 2>output.err &&
test_i18ncmp expect output &&
- test_i18ncmp expect.err output.err
+ test_must_be_empty output.err
'
cat >expect <<\EOF
diff --git a/t/t0041-usage.sh b/t/t0041-usage.sh
new file mode 100755
index 0000000..5b927b7
--- /dev/null
+++ b/t/t0041-usage.sh
@@ -0,0 +1,107 @@
+#!/bin/sh
+
+test_description='Test commands behavior when given invalid argument value'
+
+. ./test-lib.sh
+
+test_expect_success 'setup ' '
+ test_commit "v1.0"
+'
+
+test_expect_success 'tag --contains <existent_tag>' '
+ git tag --contains "v1.0" >actual 2>actual.err &&
+ grep "v1.0" actual &&
+ test_line_count = 0 actual.err
+'
+
+test_expect_success 'tag --contains <inexistent_tag>' '
+ test_must_fail git tag --contains "notag" >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_i18ngrep "error" actual.err &&
+ test_i18ngrep ! "usage" actual.err
+'
+
+test_expect_success 'tag --no-contains <existent_tag>' '
+ git tag --no-contains "v1.0" >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_line_count = 0 actual.err
+'
+
+test_expect_success 'tag --no-contains <inexistent_tag>' '
+ test_must_fail git tag --no-contains "notag" >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_i18ngrep "error" actual.err &&
+ test_i18ngrep ! "usage" actual.err
+'
+
+test_expect_success 'tag usage error' '
+ test_must_fail git tag --noopt >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_i18ngrep "usage" actual.err
+'
+
+test_expect_success 'branch --contains <existent_commit>' '
+ git branch --contains "master" >actual 2>actual.err &&
+ test_i18ngrep "master" actual &&
+ test_line_count = 0 actual.err
+'
+
+test_expect_success 'branch --contains <inexistent_commit>' '
+ test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_i18ngrep "error" actual.err &&
+ test_i18ngrep ! "usage" actual.err
+'
+
+test_expect_success 'branch --no-contains <existent_commit>' '
+ git branch --no-contains "master" >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_line_count = 0 actual.err
+'
+
+test_expect_success 'branch --no-contains <inexistent_commit>' '
+ test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_i18ngrep "error" actual.err &&
+ test_i18ngrep ! "usage" actual.err
+'
+
+test_expect_success 'branch usage error' '
+ test_must_fail git branch --noopt >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_i18ngrep "usage" actual.err
+'
+
+test_expect_success 'for-each-ref --contains <existent_object>' '
+ git for-each-ref --contains "master" >actual 2>actual.err &&
+ test_line_count = 2 actual &&
+ test_line_count = 0 actual.err
+'
+
+test_expect_success 'for-each-ref --contains <inexistent_object>' '
+ test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_i18ngrep "error" actual.err &&
+ test_i18ngrep ! "usage" actual.err
+'
+
+test_expect_success 'for-each-ref --no-contains <existent_object>' '
+ git for-each-ref --no-contains "master" >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_line_count = 0 actual.err
+'
+
+test_expect_success 'for-each-ref --no-contains <inexistent_object>' '
+ test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_i18ngrep "error" actual.err &&
+ test_i18ngrep ! "usage" actual.err
+'
+
+test_expect_success 'for-each-ref usage error' '
+ test_must_fail git for-each-ref --noopt >actual 2>actual.err &&
+ test_line_count = 0 actual &&
+ test_i18ngrep "usage" actual.err
+'
+
+test_done
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 3b90540..c59d038 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -927,10 +927,8 @@ test_expect_success 'rebase --exec works without -i ' '
test_expect_success 'rebase -i --exec without <CMD>' '
git reset --hard execute &&
set_fake_editor &&
- test_must_fail git rebase -i --exec 2>tmp &&
- sed -e "1d" tmp >actual &&
- test_must_fail git rebase -h >expected &&
- test_cmp expected actual &&
+ test_must_fail git rebase -i --exec 2>actual &&
+ test_i18ngrep "requires a value" actual &&
git checkout master
'