This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
POSIX/t/export.t: Generalize for non-ASCII platforms
authorKarl Williamson <khw@cpan.org>
Fri, 17 Oct 2014 03:07:11 +0000 (21:07 -0600)
committerKarl Williamson <khw@cpan.org>
Fri, 6 Mar 2015 04:48:27 +0000 (21:48 -0700)
ext/POSIX/t/export.t

index caa7f2b..7e18da4 100644 (file)
@@ -10,6 +10,12 @@ plan(skip_all => "POSIX is unavailable")
 require POSIX;
 POSIX->import();
 
+require($ENV{PERL_CORE} ? "../../t/charset_tools.pl" : "../t/charset_tools.pl");
+
+sub ascii_order {   # Sort helper
+    return native_to_uni($a) cmp native_to_uni($b);
+}
+
 # @POSIX::EXPORT and @POSIX::EXPORT_OK are generated. The intent of this test is
 # to catch *unintended* changes to them introduced by bugs in refactoring.
 
@@ -139,5 +145,5 @@ while (my ($var, $expect) = each %expect) {
     my $have = *{$POSIX::{$var}}{ARRAY};
     cmp_ok(@$have, '==', @$expect,
           "Correct number of entries for \@POSIX::$var");
-    is_deeply([sort @$have], $expect, "Correct entries for \@POSIX::$var");
+    is_deeply([sort ascii_order @$have], $expect, "Correct entries for \@POSIX::$var");
 }