vcs-svn: simplify cleanup in apply_one_window
[git/gitweb.git] / t / t0204-gettext-reencode-sanity.sh
blob189af90c02f1f9205567df9a3408a8c0363396a4
1 #!/bin/sh
3 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
6 test_description="Gettext reencoding of our *.po/*.mo files works"
8 . ./lib-gettext.sh
11 test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic' '
12 printf "TILRAUN: Halló Heimur!" >expect &&
13 LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: Hello World!" >actual &&
14 test_cmp expect actual
17 test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes' '
18 printf "TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ" >expect &&
19 LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: Old English Runes" >actual &&
20 test_cmp expect actual
23 test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic' '
24 printf "TILRAUN: Halló Heimur!" | iconv -f UTF-8 -t ISO8859-1 >expect &&
25 LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: Hello World!" >actual &&
26 test_cmp expect actual
29 test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes' '
30 LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: Old English Runes" >runes &&
32 if grep "^TEST: Old English Runes$" runes
33 then
34 say "Your system can not handle this complexity and returns the string as-is"
35 else
36 # Both Solaris and GNU libintl will return this stream of
37 # question marks, so it is s probably portable enough
38 printf "TILRAUN: ?? ???? ??? ?? ???? ?? ??? ????? ??????????? ??? ?? ????" >runes-expect &&
39 test_cmp runes-expect runes
43 test_expect_success GETTEXT_LOCALE 'gettext: Fetching a UTF-8 msgid -> UTF-8' '
44 printf "TILRAUN: ‚einfaldar‘ og „tvöfaldar“ gæsalappir" >expect &&
45 LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: ‘single’ and “double” quotes" >actual &&
46 test_cmp expect actual
49 # How these quotes get transliterated depends on the gettext implementation:
51 # Debian: ,einfaldar' og ,,tvöfaldar" [GNU libintl]
52 # FreeBSD: `einfaldar` og "tvöfaldar" [GNU libintl]
53 # Solaris: ?einfaldar? og ?tvöfaldar? [Solaris libintl]
55 # Just make sure the contents are transliterated, and don't use grep -q
56 # so that these differences are emitted under --verbose for curious
57 # eyes.
58 test_expect_success GETTEXT_ISO_LOCALE 'gettext: Fetching a UTF-8 msgid -> ISO-8859-1' '
59 LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: ‘single’ and “double” quotes" >actual &&
60 grep "einfaldar" actual &&
61 grep "$(echo tvöfaldar | iconv -f UTF-8 -t ISO8859-1)" actual
64 test_expect_success GETTEXT_LOCALE 'gettext.c: git init UTF-8 -> UTF-8' '
65 printf "Bjó til tóma Git lind" >expect &&
66 LANGUAGE=is LC_ALL="$is_IS_locale" git init repo >actual &&
67 test_when_finished "rm -rf repo" &&
68 grep "^$(cat expect) " actual
71 test_expect_success GETTEXT_ISO_LOCALE 'gettext.c: git init UTF-8 -> ISO-8859-1' '
72 printf "Bjó til tóma Git lind" >expect &&
73 LANGUAGE=is LC_ALL="$is_IS_iso_locale" git init repo >actual &&
74 test_when_finished "rm -rf repo" &&
75 grep "^$(cat expect | iconv -f UTF-8 -t ISO8859-1) " actual
78 test_done