Simple unit tests to validate the argument parsing.
Signed-off-by: Jeff Hostetler <[email protected]>
---
t/t7060-wtstatus.sh | 21 +++++++++++++++++++++
t/t7501-commit.sh | 14 ++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
index 44bf1d8..a39b0e2 100755
--- a/t/t7060-wtstatus.sh
+++ b/t/t7060-wtstatus.sh
@@ -228,4 +228,25 @@ test_expect_success 'status --branch with detached HEAD' '
test_i18ncmp expected actual
'
+## Duplicate the above test and verify --porcelain=1 has no effect.
+test_expect_success 'status --branch with detached HEAD' '
+ git reset --hard &&
+ git checkout master^0 &&
+ git status --branch --porcelain=1 >actual &&
+ cat >expected <<-EOF &&
+ ## HEAD (no branch)
+ ?? .gitconfig
+ ?? actual
+ ?? expect
+ ?? expected
+ ?? mdconflict/
+ EOF
+ test_i18ncmp expected actual
+'
+
+## Verify parser error on --porcelain argument.
+test_expect_failure 'status --porcelain=bogus' '
+ git status --porcelain=bogus
+'
+
test_done
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index d84897a..1a74d75 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -73,6 +73,10 @@ test_expect_success '--porcelain fails with nothing to
commit' '
test_must_fail git commit -m initial --porcelain
'
+test_expect_success '--porcelain=1 fails with nothing to commit' '
+ test_must_fail git commit -m initial --porcelain=1
+'
+
test_expect_success '--long fails with nothing to commit' '
test_must_fail git commit -m initial --long
'
@@ -97,6 +101,16 @@ test_expect_failure '--porcelain with stuff to commit
returns ok' '
git commit -m next -a --porcelain
'
+test_expect_failure '--porcelain=1 with stuff to commit returns ok' '
+ echo bongo bongo bongo >>file &&
+ git commit -m next -a --porcelain=1
+'
+
+test_expect_failure '--porcelain=bogus with stuff to commit returns ok' '
+ echo bongo bongo bongo >>file &&
+ git commit -m next -a --porcelain=bogus
+'
+
test_expect_success '--long with stuff to commit returns ok' '
echo bongo bongo bongo >>file &&
git commit -m next -a --long
--
2.8.0.rc4.17.gac42084.dirty
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html