From: Junio C Hamano Date: Wed, 7 Jul 2010 18:18:44 +0000 (-0700) Subject: Merge branch 'ab/tap' X-Git-Tag: v1.7.2-rc2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/2a16315031cf478601ea150f7861d4f86b1350a2?ds=inline;hp=-c Merge branch 'ab/tap' * ab/tap: t/README: document more test helpers t/README: proposed rewording... t/README: Document the do's and don'ts of tests t/README: Add a section about skipping tests t/README: Document test_expect_code t/README: Document test_external* t/README: Document the prereq functions, and 3-arg test_* t/README: Typo: paralell -> parallel t/README: The trash is in 't/trash directory.$name' t/t9700/test.pl: don't access private object members, use public access methods t9700: Use Test::More->builder, not $Test::Builder::Test tests: Say "pass" rather than "ok" on empty lines for TAP tests: Skip tests in a way that makes sense under TAP test-lib: output a newline before "ok" under a TAP harness test-lib: Make the test_external_* functions TAP-aware test-lib: Adjust output to be valid TAP format --- 2a16315031cf478601ea150f7861d4f86b1350a2 diff --combined t/t7006-pager.sh index c2a3c8e2e7,171a754e53..eb9651da89 --- a/t/t7006-pager.sh +++ b/t/t7006-pager.sh @@@ -3,7 -3,6 +3,7 @@@ test_description='Test automatic use of a pager.' . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-pager.sh cleanup_fail() { echo >&2 cleanup failed @@@ -37,7 -36,7 +37,7 @@@ the } test_set_prereq TTY else - say no usable terminal, so skipping some tests + say "# no usable terminal, so skipping some tests" fi test_expect_success 'setup' ' @@@ -159,12 -158,21 +159,12 @@@ test_expect_success 'color when writin colorful colorful.log ' -test_expect_success 'determine default pager' ' - unset PAGER GIT_PAGER; - test_might_fail git config --unset core.pager || - cleanup_fail && - - less=$(git var GIT_PAGER) && - test -n "$less" -' - -if expr "$less" : '[a-z][a-z]*$' >/dev/null && test_have_prereq TTY +if test_have_prereq SIMPLEPAGER && test_have_prereq TTY then - test_set_prereq SIMPLEPAGER + test_set_prereq SIMPLEPAGERTTY fi -test_expect_success SIMPLEPAGER 'default pager is used by default' ' +test_expect_success SIMPLEPAGERTTY 'default pager is used by default' ' unset PAGER GIT_PAGER; test_might_fail git config --unset core.pager && rm -f default_pager_used || diff --combined t/t9001-send-email.sh index 382ab6c98a,ddc3d8db9f..23597cc407 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@@ -4,7 -4,7 +4,7 @@@ test_description='git send-email . ./test-lib.sh if ! test_have_prereq PERL; then - say 'skipping git send-email tests, perl not available' + skip_all='skipping git send-email tests, perl not available' test_done fi @@@ -58,7 -58,7 +58,7 @@@ test_no_confirm () # Exit immediately to prevent hang if a no-confirm test fails check_no_confirm () { test -f no_confirm_okay || { - say 'No confirm test failed; skipping remaining tests to prevent hanging' + skip_all='confirm test failed; skipping remaining tests to prevent hanging' test_done } } @@@ -918,81 -918,4 +918,81 @@@ test_expect_success '--no-bcc override ! grep "RCPT TO:" stdout ' +cat >email-using-8bit < +From: author@example.com +Date: Sat, 12 Jun 2010 15:53:58 +0200 +Subject: subject goes here + +Dieser deutsche Text enthält einen Umlaut! +EOF + +cat >content-type-decl <stdout && + grep "do not declare a Content-Transfer-Encoding" stdout && + grep email-using-8bit stdout && + grep "Which 8bit encoding" stdout && + egrep "Content|MIME" msgtxt1 >actual && + test_cmp actual content-type-decl +' + +test_expect_success 'sendemail.8bitEncoding works' ' + clean_fake_sendmail && + git config sendemail.assume8bitEncoding UTF-8 && + echo bogus | + git send-email --from=author@example.com --to=nobody@example.com \ + --smtp-server="$(pwd)/fake.sendmail" \ + email-using-8bit >stdout && + egrep "Content|MIME" msgtxt1 >actual && + test_cmp actual content-type-decl +' + +test_expect_success '--8bit-encoding overrides sendemail.8bitEncoding' ' + clean_fake_sendmail && + git config sendemail.assume8bitEncoding "bogus too" && + echo bogus | + git send-email --from=author@example.com --to=nobody@example.com \ + --smtp-server="$(pwd)/fake.sendmail" \ + --8bit-encoding=UTF-8 \ + email-using-8bit >stdout && + egrep "Content|MIME" msgtxt1 >actual && + test_cmp actual content-type-decl +' + +cat >email-using-8bit < +From: author@example.com +Date: Sat, 12 Jun 2010 15:53:58 +0200 +Subject: Dieser Betreff enthält auch einen Umlaut! + +Nothing to see here. +EOF + +cat >expected <stdout && + grep "Subject" msgtxt1 >actual && + test_cmp expected actual +' + test_done