[perl-Glib] t/options.t: skip tests in non-UTF-8 locales



commit 215711b496a70836aabdc08bbdc26b90a3fa2cec
Author: Brian Manning <bmanning src gnome org>
Date:   Sat Jul 6 23:02:35 2013 -0700

    t/options.t: skip tests in non-UTF-8 locales
    
    - Skip the tests for wide characters when the shell environment is set
      to a non-UTF-8 locale; fixes RT#83490

 t/options.t |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/t/options.t b/t/options.t
index dc807e0..7de70f7 100644
--- a/t/options.t
+++ b/t/options.t
@@ -156,7 +156,22 @@ my $entries = [
   }
 
   # Test that there is no double-encoding for utf8-encoded strings.
-  {
+SKIP:  {
+    my $codeset;
+    # This eval() was taken from <https://metacpan.org/module/I18N::Langinfo>
+    # and from a suggestion from Kevin Ryde
+    eval {
+        require I18N::Langinfo;
+        $codeset = I18N::Langinfo::langinfo(I18N::Langinfo::CODESET());
+    };
+    # If there was an error requiring I18N::Langinfo, then skip this block of
+    # tests; we need I18N::Langinfo to check LC_ALL/LANG
+    skip("Can't check LC_ALL/LANG, I18N::Langinfo unavailable; $@", 4)
+        if ( length($@) > 0 );
+    # If LC_ALL/LANG is not some variant of UTF-8 (8-bit, wide/multibyte
+    # characters), skip this block of tests
+    skip("Can't test parsing of wide-byte args (non-UTF-8 locale: $codeset)", 4)
+        if ( $codeset !~ /UTF-8|utf8/i );
     @ARGV = qw(-s ❤ ❤);
     $context -> parse();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]