File tree 3 files changed +51
-36
lines changed 3 files changed +51
-36
lines changed Original file line number Diff line number Diff line change @@ -4802,6 +4802,7 @@ t/re/uniprops.t Test unicode \p{} regex constructs
4802
4802
t/run/cloexec.t Test close-on-exec.
4803
4803
t/run/exit.t Test perl's exit status.
4804
4804
t/run/fresh_perl.t Tests that require a fresh perl.
4805
+ t/run/locale.t Tests related to locale handling
4805
4806
t/run/noswitch.t Test aliasing ARGV for other switch tests
4806
4807
t/run/runenv.t Test if perl honors its environment variables.
4807
4808
t/run/script.t See if script invocation works
Original file line number Diff line number Diff line change 565
565
EXPECT
566
566
ok
567
567
########
568
- # This test is here instead of lib/locale.t because
569
- # the bug depends on in the internal state of the locale
570
- # settings and pragma/locale messes up that state pretty badly.
571
- # We need a "fresh run".
572
- BEGIN {
573
- eval { require POSIX };
574
- if ($@) {
575
- exit(0); # running minitest?
576
- }
577
- }
578
- use Config;
579
- my $have_setlocale = $Config{d_setlocale} eq 'define';
580
- $have_setlocale = 0 if $@;
581
- # Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1"
582
- # and mingw32 uses said silly CRT
583
- $have_setlocale = 0 if (($^O eq 'MSWin32' || $^O eq 'NetWare') && $Config{cc} =~ /^(cl|gcc)/i);
584
- exit(0) unless $have_setlocale;
585
- my @locales;
586
- if (-x "/usr/bin/locale" && open(LOCALES, "/usr/bin/locale -a 2>/dev/null|")) {
587
- while(<LOCALES>) {
588
- chomp;
589
- push(@locales, $_);
590
- }
591
- close(LOCALES);
592
- }
593
- exit(0) unless @locales;
594
- for (@locales) {
595
- use POSIX qw(locale_h);
596
- use locale;
597
- setlocale(LC_NUMERIC, $_) or next;
598
- my $s = sprintf "%g %g", 3.1, 3.1;
599
- next if $s eq '3.1 3.1' || $s =~ /^(3.+1) \1$/;
600
- print "$_ $s\n";
601
- }
602
- EXPECT
603
- ########
604
568
# [ID 20001202.002] and change #8066 added 'at -e line 1';
605
569
# reversed again as a result of [perl #17763]
606
570
die qr(x)
Original file line number Diff line number Diff line change
1
+ # !./perl
2
+ BEGIN {
3
+ chdir ' t' if -d ' t' ;
4
+ @INC = ' ../lib' ;
5
+ require ' ./test.pl' ; # for fresh_perl_is() etc
6
+ }
7
+
8
+ use strict;
9
+
10
+ # #######
11
+ # This test is here instead of lib/locale.t because
12
+ # the bug depends on in the internal state of the locale
13
+ # settings and pragma/locale messes up that state pretty badly.
14
+ # We need a "fresh run".
15
+ BEGIN {
16
+ eval { require POSIX };
17
+ if ($@ ) {
18
+ skip_all(" could not load the POSIX module" ); # running minitest?
19
+ }
20
+ }
21
+ use Config;
22
+ my $have_setlocale = $Config {d_setlocale } eq ' define' ;
23
+ $have_setlocale = 0 if $@ ;
24
+ # Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1"
25
+ # and mingw32 uses said silly CRT
26
+ $have_setlocale = 0 if (($^O eq ' MSWin32' || $^O eq ' NetWare' ) && $Config {cc } =~ / ^(cl|gcc)/i );
27
+ skip_all(" no setlocale available" ) unless $have_setlocale ;
28
+ my @locales ;
29
+ if (-x " /usr/bin/locale" && open (LOCALES, " /usr/bin/locale -a 2>/dev/null|" )) {
30
+ while (<LOCALES>) {
31
+ chomp ;
32
+ push (@locales , $_ );
33
+ }
34
+ close (LOCALES);
35
+ }
36
+ skip_all(" no locales available" ) unless @locales ;
37
+
38
+ plan tests => &last ;
39
+ fresh_perl_is(" for (qw(@locales )) {\n " . <<'EOF' ,
40
+ use POSIX qw(locale_h);
41
+ use locale;
42
+ setlocale(LC_NUMERIC, "$_") or next;
43
+ my $s = sprintf "%g %g", 3.1, 3.1;
44
+ next if $s eq '3.1 3.1' || $s =~ /^(3.+1) \1$/;
45
+ print "$_ $s\n";
46
+ }
47
+ EOF
48
+ " " , {}, " no locales where LC_NUMERIC breaks" );
49
+
50
+ sub last { 1 }
You can’t perform that action at this time.
0 commit comments