MacOS: skip test "convert invalid UTF-8 to ISO-8859-1"
authorFriedrich Beckmann <friedrich.beckmann@gmx.de>
Sat, 4 Nov 2023 18:40:50 +0000 (19:40 +0100)
committerFriedrich Beckmann <friedrich.beckmann@gmx.de>
Sat, 4 Nov 2023 18:40:50 +0000 (19:40 +0100)
Starting with MacOS 14 Sonoma Apple has changed the behaviour
of the iconv library. The test tests the behaviour for invalid
UTF-8 sequence 0xC0. The native Apple iconv library responds with
a different error number than expected. This patch skips the
test on MacOS until this is hopefully fixed on MacOS.

tests/libpspp/i18n.at

index d0e87bb3b9ed820fce1f79e8dbbb340a8b36ff50..9d23aeb59c161358aa0e6b1f54ba18add463f8ef 100644 (file)
@@ -40,8 +40,19 @@ CHECK_I18N_RECODE([from UTF-8 to ISO-8859-1], [UTF-8], [ISO-8859-1],
                   [\302\242], [\242])
 
 # 0xc0 == 0300 is invalid in UTF-8
-CHECK_I18N_RECODE([invalid UTF-8 to ISO-8859-1], [UTF-8], [ISO-8859-1],
-                  [xy\300z], [xy?z])
+AT_SETUP([convert invalid UTF-8 to ISO-8859-1])
+AT_KEYWORDS([i18n])
+dnl This test fails on Mac OS 14 Sonoma due to changes in the native
+dnl MacOS iconv library. Skip the test on MacOS.
+AT_CHECK([case $host in #(
+  *-linux*) ;; #(
+  *) exit 77
+esac])
+dnl Skip the test if this host doesn't know the source and target encodings.
+AT_CHECK([i18n-test supports_encodings 'UTF-8' 'ISO-8859-1'])
+AT_CHECK_UNQUOTED([i18n-test recode 'UTF-8' 'ISO-8859-1' 'xy\300z'], [0], [`printf 'xy?z'`])
+AT_CLEANUP])
+
 # 0xc2 == 0302 is the first byte of a 2-byte UTF-8 sequence
 CHECK_I18N_RECODE([truncated UTF-8 to ISO-8559-1], [UTF-8], [ISO-8859-1],
                   [xy\302], [xy?])