@@ -7,6 +7,10 @@ test_description="Gettext reencoding of our *.po/*.mo files works"
7
7
8
8
. ./lib-gettext.sh
9
9
10
+ # The constants used in a tricky observation for undefined behaviour
11
+ RUNES=" TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ"
12
+ PUNTS=" TILRAUN: ?? ???? ??? ?? ???? ?? ??? ????? ??????????? ??? ?? ????"
13
+ MSGKEY=" TEST: Old English Runes"
10
14
11
15
test_expect_success GETTEXT_LOCALE ' gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic' '
12
16
printf "TILRAUN: Halló Heimur!" >expect &&
@@ -15,8 +19,8 @@ test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo
15
19
'
16
20
17
21
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 &&
22
+ printf "%s" "$RUNES " >expect &&
23
+ LANGUAGE=is LC_ALL="$is_IS_locale" gettext "$MSGKEY " >actual &&
20
24
test_cmp expect actual
21
25
'
22
26
@@ -26,18 +30,23 @@ test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UT
26
30
test_cmp expect actual
27
31
'
28
32
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 &&
31
-
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
40
- fi
33
+ test_expect_success GETTEXT_ISO_LOCALE ' gettext: impossible ISO-8859-1 output' '
34
+ LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "$MSGKEY" >runes &&
35
+ case "$(cat runes)" in
36
+ "$MSGKEY")
37
+ say "Your system gives back the key to message catalog"
38
+ ;;
39
+ "$PUNTS")
40
+ say "Your system replaces an impossible character with ?"
41
+ ;;
42
+ "$RUNES")
43
+ say "Your system gives back the raw message for an impossible request"
44
+ ;;
45
+ *)
46
+ say "We never saw the error behaviour your system exhibits"
47
+ false
48
+ ;;
49
+ esac
41
50
'
42
51
43
52
test_expect_success GETTEXT_LOCALE ' gettext: Fetching a UTF-8 msgid -> UTF-8' '
0 commit comments