diff options
author | Niko Tyni <ntyni@debian.org> | 2015-04-15 18:41:57 +0300 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2015-06-03 11:23:06 +1000 |
commit | c53481e75d6e6f7e5c3c838b3545b07a959c67cc (patch) | |
tree | dee9c30948844b9dc4dd5295cac17ad11a4e50ee /t | |
parent | 31ada1fbe5f99b57f19d888d2681aa42d8b87898 (diff) | |
download | perl-c53481e75d6e6f7e5c3c838b3545b07a959c67cc.tar.gz |
Make t/run/locale.t survive missing locales masked by LC_ALL
If LC_ALL is set to a valid locale but another LC_* setting like LC_CTYPE
isn't, t/run/locale.t would fail because it explicitly unsets LC_ALL,
unmasking the problem underneath. All the other tests survive such
a scenario.
While this is clearly an error in the build environment, it's easy to make
the test more robust by first clearing all the locale relevant variables.
Bug-Debian: https://bugs.debian.org/782068
Diffstat (limited to 't')
-rw-r--r-- | t/run/locale.t | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/t/run/locale.t b/t/run/locale.t index bd1a0348c7..eb1202b68d 100644 --- a/t/run/locale.t +++ b/t/run/locale.t @@ -27,6 +27,9 @@ my @locales = eval { find_locales( [ &LC_ALL, &LC_CTYPE, &LC_NUMERIC ], ) }; skip_all("no locales available") unless @locales; +# reset the locale environment +local @ENV{'LANG', (grep /^LC_/, keys %ENV)}; + plan tests => &last; my $non_C_locale; @@ -58,9 +61,6 @@ EOF SKIP: { skip("Windows stores locale defaults in the registry", 1 ) if $^O eq 'MSWin32'; - local $ENV{LC_NUMERIC}; # So not taken as a default - local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC - local $ENV{LANG}; # So not taken as a default fresh_perl_is("for (qw(@locales)) {\n" . <<'EOF', use POSIX qw(locale_h); use locale; @@ -120,7 +120,6 @@ SKIP: { note("using the '$different' locale for LC_NUMERIC tests"); { local $ENV{LC_NUMERIC} = $different; - local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC fresh_perl_is(<<'EOF', "4.2", {}, format STDOUT = @@ -260,7 +259,6 @@ EOF { local $ENV{LC_NUMERIC} = $different; - local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC fresh_perl_is(<<'EOF', "$difference "x4, {}, use locale; use POSIX qw(locale_h); @@ -272,8 +270,6 @@ EOF { local $ENV{LC_NUMERIC} = $different; - local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC - local $ENV{LANG}; # so on Windows gets sys default locale fresh_perl_is(<<'EOF', "$difference "x4, {}, use locale; use POSIX qw(locale_h); @@ -348,7 +344,6 @@ EOF { local $ENV{LC_NUMERIC} = $different; - local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC fresh_perl_is(<<"EOF", use POSIX qw(locale_h); |