mirror of
https://github.com/git/git.git
synced 2026-01-26 16:57:22 +09:00
t7500: make each piece more independent
These tests prepare the working tree & index state to have something to be committed, and try a sequence of "test_must_fail git commit". If an earlier one did not fail by a bug, a later one will fail for a wrong reason (namely, "nothing to commit"). Give them "--allow-empty" to make sure that they would work even when there is nothing to commit by accident. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
This commit is contained in:
parent
ef8ce8f3d4
commit
82d283c626
@ -50,33 +50,33 @@ test_expect_success 'nonexistent template file in config should return error' '
|
||||
TEMPLATE="$PWD"/template
|
||||
|
||||
test_expect_success 'unedited template should not commit' '
|
||||
echo "template line" > "$TEMPLATE" &&
|
||||
test_must_fail git commit --template "$TEMPLATE"
|
||||
echo "template line" >"$TEMPLATE" &&
|
||||
test_must_fail git commit --allow-empty --template "$TEMPLATE"
|
||||
'
|
||||
|
||||
test_expect_success 'unedited template with comments should not commit' '
|
||||
echo "# comment in template" >> "$TEMPLATE" &&
|
||||
test_must_fail git commit --template "$TEMPLATE"
|
||||
echo "# comment in template" >>"$TEMPLATE" &&
|
||||
test_must_fail git commit --allow-empty --template "$TEMPLATE"
|
||||
'
|
||||
|
||||
test_expect_success 'a Signed-off-by line by itself should not commit' '
|
||||
(
|
||||
test_set_editor "$TEST_DIRECTORY"/t7500/add-signed-off &&
|
||||
test_must_fail git commit --template "$TEMPLATE"
|
||||
test_must_fail git commit --allow-empty --template "$TEMPLATE"
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'adding comments to a template should not commit' '
|
||||
(
|
||||
test_set_editor "$TEST_DIRECTORY"/t7500/add-comments &&
|
||||
test_must_fail git commit --template "$TEMPLATE"
|
||||
test_must_fail git commit --allow-empty --template "$TEMPLATE"
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'adding real content to a template should commit' '
|
||||
(
|
||||
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
|
||||
git commit --template "$TEMPLATE"
|
||||
git commit --allow-empty --template "$TEMPLATE"
|
||||
) &&
|
||||
commit_msg_is "template linecommit message"
|
||||
'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user