mirror of
https://github.com/git/git.git
synced 2024-12-14 20:33:46 +08:00
d3c6751b18
Change various tests that use an idiom of the form:
>expect &&
test_cmp expect actual
To instead use:
test_must_be_empty actual
The test_must_be_empty() wrapper was introduced in ca8d148daf
("test:
test_must_be_empty helper", 2013-06-09). Many of these tests have been
added after that time. This was mostly found with, and manually pruned
from:
git grep '^\s+>.*expect.* &&$' t
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
68 lines
1.1 KiB
Bash
Executable File
68 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='git reset should work on unborn branch'
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'setup' '
|
|
echo a >a &&
|
|
echo b >b
|
|
'
|
|
|
|
test_expect_success 'reset' '
|
|
git add a b &&
|
|
git reset &&
|
|
|
|
git ls-files >actual &&
|
|
test_must_be_empty actual
|
|
'
|
|
|
|
test_expect_success 'reset HEAD' '
|
|
rm .git/index &&
|
|
git add a b &&
|
|
test_must_fail git reset HEAD
|
|
'
|
|
|
|
test_expect_success 'reset $file' '
|
|
rm .git/index &&
|
|
git add a b &&
|
|
git reset a &&
|
|
|
|
echo b >expect &&
|
|
git ls-files >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success PERL 'reset -p' '
|
|
rm .git/index &&
|
|
git add a &&
|
|
echo y >yes &&
|
|
git reset -p <yes >output &&
|
|
|
|
git ls-files >actual &&
|
|
test_must_be_empty actual &&
|
|
test_i18ngrep "Unstage" output
|
|
'
|
|
|
|
test_expect_success 'reset --soft is a no-op' '
|
|
rm .git/index &&
|
|
git add a &&
|
|
git reset --soft &&
|
|
|
|
echo a >expect &&
|
|
git ls-files >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'reset --hard' '
|
|
rm .git/index &&
|
|
git add a &&
|
|
test_when_finished "echo a >a" &&
|
|
git reset --hard &&
|
|
|
|
git ls-files >actual &&
|
|
test_must_be_empty actual &&
|
|
test_path_is_missing a
|
|
'
|
|
|
|
test_done
|