summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-01-12 20:17:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-12 22:04:40 (GMT)
commit1db421ab85c44c46f6908eb03d1459d636e2b959 (patch)
treeb0e0e97405a13954fe5b425f3ada24d992caec40 /t
parente9931ace4f69998b7dfaa52701d4e16e7dd50160 (diff)
downloadgit-1db421ab85c44c46f6908eb03d1459d636e2b959.zip
git-1db421ab85c44c46f6908eb03d1459d636e2b959.tar.gz
git-1db421ab85c44c46f6908eb03d1459d636e2b959.tar.bz2
mailmap tests: improve --stdin tests
The --stdin tests setup the "contact" file in the main setup, let's instead set it up in the test that uses it. Also refactor the first test so it's obvious that the point of it is that "check-mailmap" will spew its input as-is when given no argument. For that one we can just use the "expect" file as-is. Also add tests for how other "--stdin" cases are handled, e.g. one where we actually do a mapping. For the rest of --stdin testing we just assume we're going to get the same output. We could follow-up and make sure everything's round-tripped through both --stdin and the file/blob backends, but I don't think there's much point in that. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4203-mailmap.sh40
1 files changed, 32 insertions, 8 deletions
diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 61d1b62..dbd3656 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -13,11 +13,6 @@ fuzz_blame () {
}
test_expect_success 'setup commits and contacts file' '
- cat >contacts <<-EOF &&
- $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
- nick1 <bugs@company.xx>
- EOF
-
echo one >one &&
git add one &&
test_tick &&
@@ -48,24 +43,53 @@ test_expect_success 'check-mailmap --stdin' '
$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
nick1 <bugs@company.xx>
EOF
- git check-mailmap --stdin <contacts >actual &&
+ git check-mailmap --stdin <expect >actual &&
test_cmp expect actual
'
-test_expect_success 'check-mailmap --stdin arguments' '
+test_expect_success 'check-mailmap --stdin arguments: no mapping' '
+ test_when_finished "rm contacts" &&
+ cat >contacts <<-EOF &&
+ $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
+ nick1 <bugs@company.xx>
+ EOF
cat >expect <<-\EOF &&
Internal Guy <bugs@company.xy>
EOF
- cat <contacts >>expect &&
+ cat contacts >>expect &&
+
git check-mailmap --stdin "Internal Guy <bugs@company.xy>" \
<contacts >actual &&
test_cmp expect actual
'
+test_expect_success 'check-mailmap --stdin arguments: mapping' '
+ test_when_finished "rm .mailmap" &&
+ cat >.mailmap <<-EOF &&
+ New Name <$GIT_AUTHOR_EMAIL>
+ EOF
+ cat >stdin <<-EOF &&
+ Old Name <$GIT_AUTHOR_EMAIL>
+ EOF
+
+ cp .mailmap expect &&
+ git check-mailmap --stdin <stdin >actual &&
+ test_cmp expect actual &&
+
+ cat .mailmap >>expect &&
+ git check-mailmap --stdin "Another Old Name <$GIT_AUTHOR_EMAIL>" \
+ <stdin >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'check-mailmap bogus contact' '
test_must_fail git check-mailmap bogus
'
+test_expect_success 'check-mailmap bogus contact --stdin' '
+ test_must_fail git check-mailmap --stdin bogus </dev/null
+'
+
test_expect_success 'No mailmap' '
cat >expect <<-EOF &&
$GIT_AUTHOR_NAME (1):