From 9205bfbef3dcd8d0361a04471c09d49e7a816b47 Mon Sep 17 00:00:00 2001 From: Karsten Blees Date: Tue, 21 Dec 2010 02:06:40 +0100 Subject: [PATCH] Mark unicode-related tests broken on msys MSys bash doesn't support unicode at all. Testing a unicode-enabled git with an encoding-agnostic bash cannot work. This patch adds a new test function test_expect_success_unicode that tests whether the shell is capable of passing unicode strings to another process. If that works, the test is expected to succeed, otherwise it's expected to fail. Tested-by: Kirill Smelkov Signed-off-by: Karsten Blees --- t/t3901-i18n-patch.sh | 28 ++++++++++++++-------------- t/t4201-shortlog.sh | 6 +++--- t/t8005-blame-i18n.sh | 9 +++++---- t/test-lib.sh | 13 +++++++++++++ 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh index 31a5770b34..d19255d5c2 100755 --- a/t/t3901-i18n-patch.sh +++ b/t/t3901-i18n-patch.sh @@ -67,7 +67,7 @@ test_expect_success setup ' git config i18n.commitencoding UTF-8 ' -test_expect_success 'format-patch output (ISO-8859-1)' ' +test_expect_success_unicode 'format-patch output (ISO-8859-1)' ' git config i18n.logoutputencoding ISO8859-1 && git format-patch --stdout master..HEAD^ >out-l1 && @@ -78,7 +78,7 @@ test_expect_success 'format-patch output (ISO-8859-1)' ' grep "^From: =?ISO8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l2 ' -test_expect_success 'format-patch output (UTF-8)' ' +test_expect_success_unicode 'format-patch output (UTF-8)' ' git config i18n.logoutputencoding UTF-8 && git format-patch --stdout master..HEAD^ >out-u1 && @@ -89,7 +89,7 @@ test_expect_success 'format-patch output (UTF-8)' ' grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u2 ' -test_expect_success 'rebase (U/U)' ' +test_expect_success_unicode 'rebase (U/U)' ' # We want the result of rebase in UTF-8 git config i18n.commitencoding UTF-8 && @@ -108,7 +108,7 @@ test_expect_success 'rebase (U/U)' ' check_encoding 2 ' -test_expect_success 'rebase (U/L)' ' +test_expect_success_unicode 'rebase (U/L)' ' git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding ISO8859-1 && . "$TEST_DIRECTORY"/t3901-utf8.txt && @@ -119,7 +119,7 @@ test_expect_success 'rebase (U/L)' ' check_encoding 2 ' -test_expect_success 'rebase (L/L)' ' +test_expect_success_unicode 'rebase (L/L)' ' # In this test we want ISO-8859-1 encoded commits as the result git config i18n.commitencoding ISO8859-1 && git config i18n.logoutputencoding ISO8859-1 && @@ -131,7 +131,7 @@ test_expect_success 'rebase (L/L)' ' check_encoding 2 8859 ' -test_expect_success 'rebase (L/U)' ' +test_expect_success_unicode 'rebase (L/U)' ' # This is pathological -- use UTF-8 as intermediate form # to get ISO-8859-1 results. git config i18n.commitencoding ISO8859-1 && @@ -144,7 +144,7 @@ test_expect_success 'rebase (L/U)' ' check_encoding 2 8859 ' -test_expect_success 'cherry-pick(U/U)' ' +test_expect_success_unicode 'cherry-pick(U/U)' ' # Both the commitencoding and logoutputencoding is set to UTF-8. git config i18n.commitencoding UTF-8 && @@ -159,7 +159,7 @@ test_expect_success 'cherry-pick(U/U)' ' check_encoding 3 ' -test_expect_success 'cherry-pick(L/L)' ' +test_expect_success_unicode 'cherry-pick(L/L)' ' # Both the commitencoding and logoutputencoding is set to ISO-8859-1 git config i18n.commitencoding ISO8859-1 && @@ -174,7 +174,7 @@ test_expect_success 'cherry-pick(L/L)' ' check_encoding 3 8859 ' -test_expect_success 'cherry-pick(U/L)' ' +test_expect_success_unicode 'cherry-pick(U/L)' ' # Commitencoding is set to UTF-8 but logoutputencoding is ISO-8859-1 git config i18n.commitencoding UTF-8 && @@ -189,7 +189,7 @@ test_expect_success 'cherry-pick(U/L)' ' check_encoding 3 ' -test_expect_success 'cherry-pick(L/U)' ' +test_expect_success_unicode 'cherry-pick(L/U)' ' # Again, the commitencoding is set to ISO-8859-1 but # logoutputencoding is set to UTF-8. @@ -205,7 +205,7 @@ test_expect_success 'cherry-pick(L/U)' ' check_encoding 3 8859 ' -test_expect_success 'rebase --merge (U/U)' ' +test_expect_success_unicode 'rebase --merge (U/U)' ' git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding UTF-8 && . "$TEST_DIRECTORY"/t3901-utf8.txt && @@ -216,7 +216,7 @@ test_expect_success 'rebase --merge (U/U)' ' check_encoding 2 ' -test_expect_success 'rebase --merge (U/L)' ' +test_expect_success_unicode 'rebase --merge (U/L)' ' git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding ISO8859-1 && . "$TEST_DIRECTORY"/t3901-utf8.txt && @@ -227,7 +227,7 @@ test_expect_success 'rebase --merge (U/L)' ' check_encoding 2 ' -test_expect_success 'rebase --merge (L/L)' ' +test_expect_success_unicode 'rebase --merge (L/L)' ' # In this test we want ISO-8859-1 encoded commits as the result git config i18n.commitencoding ISO8859-1 && git config i18n.logoutputencoding ISO8859-1 && @@ -239,7 +239,7 @@ test_expect_success 'rebase --merge (L/L)' ' check_encoding 2 8859 ' -test_expect_success 'rebase --merge (L/U)' ' +test_expect_success_unicode 'rebase --merge (L/U)' ' # This is pathological -- use UTF-8 as intermediate form # to get ISO-8859-1 results. git config i18n.commitencoding ISO8859-1 && diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh index 6872ba1a42..276bd49feb 100755 --- a/t/t4201-shortlog.sh +++ b/t/t4201-shortlog.sh @@ -93,7 +93,7 @@ test_expect_success 'output from user-defined format is re-wrapped' ' test_cmp expect log.predictable ' -test_expect_success 'shortlog wrapping' ' +test_expect_success_unicode 'shortlog wrapping' ' cat >expect <<\EOF && A U Thor (5): Test @@ -114,7 +114,7 @@ EOF test_cmp expect out ' -test_expect_success 'shortlog from non-git directory' ' +test_expect_success_unicode 'shortlog from non-git directory' ' git log HEAD >log && GIT_DIR=non-existing git shortlog -w out && test_cmp expect out @@ -135,7 +135,7 @@ $DSCHO (2): EOF -test_expect_success 'shortlog encoding' ' +test_expect_success_unicode 'shortlog encoding' ' git reset --hard "$commit" && git config --unset i18n.commitencoding && echo 2 > a1 && diff --git a/t/t8005-blame-i18n.sh b/t/t8005-blame-i18n.sh index cb390559f9..6affb78fa9 100755 --- a/t/t8005-blame-i18n.sh +++ b/t/t8005-blame-i18n.sh @@ -1,6 +1,7 @@ #!/bin/sh test_description='git blame encoding conversion' + . ./test-lib.sh . "$TEST_DIRECTORY"/t8005/utf8.txt @@ -33,7 +34,7 @@ author $SJIS_NAME summary $SJIS_MSG EOF -test_expect_success \ +test_expect_success_unicode \ 'blame respects i18n.commitencoding' ' git blame --incremental file | \ egrep "^(author|summary) " > actual && @@ -49,7 +50,7 @@ author $EUC_JAPAN_NAME summary $EUC_JAPAN_MSG EOF -test_expect_success \ +test_expect_success_unicode \ 'blame respects i18n.logoutputencoding' ' git config i18n.logoutputencoding eucJP && git blame --incremental file | \ @@ -66,7 +67,7 @@ author $UTF8_NAME summary $UTF8_MSG EOF -test_expect_success \ +test_expect_success_unicode \ 'blame respects --encoding=UTF-8' ' git blame --incremental --encoding=UTF-8 file | \ egrep "^(author|summary) " > actual && @@ -82,7 +83,7 @@ author $UTF8_NAME summary $UTF8_MSG EOF -test_expect_success \ +test_expect_success_unicode \ 'blame respects --encoding=none' ' git blame --incremental --encoding=none file | \ egrep "^(author|summary) " > actual && diff --git a/t/test-lib.sh b/t/test-lib.sh index 2ac8cab14e..0df4644d66 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -536,6 +536,19 @@ test_expect_success () { echo >&3 "" } +# test if shell supports unicode, expect success if it does, otherwise failure +test_expect_success_unicode () { +tclsh -ÀÁÂ <