In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/592808d835b3ffde15f01fa99e513c647a8f08d9?hp=5d4ff2313b84e128251ca88da0f7a2eef62adb24>
- Log ----------------------------------------------------------------- commit 592808d835b3ffde15f01fa99e513c647a8f08d9 Author: Craig A. Berry <[email protected]> Date: Fri Sep 16 12:08:19 2011 -0500 Assorted File::Glob test fix-ups following 528bd3ce85. - Avoid list assignment to %ENV, which fails at compile time on VMS. - Use consistent indentation for readability. - Mark bsd_glob('~') tests TODO on VMS. The HOME path is successfully retrieved, but it normally contains square brackets, which confuse glob, because it thinks the directory portion of the path contained within brackets is a pattern. The path probably needs to be converted to Unix syntax first. ----------------------------------------------------------------------- Summary of changes: ext/File-Glob/t/basic.t | 56 ++++++++++++++++++++++++++-------------------- 1 files changed, 32 insertions(+), 24 deletions(-) diff --git a/ext/File-Glob/t/basic.t b/ext/File-Glob/t/basic.t index dffffc8..c40b1d5 100644 --- a/ext/File-Glob/t/basic.t +++ b/ext/File-Glob/t/basic.t @@ -71,36 +71,42 @@ SKIP: { # check plain tilde expansion { my $tilde_check = sub { - my @a = bsd_glob('~'); + my @a = bsd_glob('~'); - if (GLOB_ERROR) { - fail(GLOB_ERROR); - } else { - is_deeply (\@a, [$_[0]], join ' - ', 'tilde expansion', @_ > 1 ? $_[1] : ()); - } + if (GLOB_ERROR) { + fail(GLOB_ERROR); + } else { + is_deeply (\@a, [$_[0]], join ' - ', 'tilde expansion', @_ > 1 ? $_[1] : ()); + } }; my $passwd_home = eval { (getpwuid($>))[7] }; - { - local %ENV = %ENV; - delete $ENV{HOME}; - delete $ENV{USERPROFILE}; - $tilde_check->(defined $passwd_home ? $passwd_home : q{~}, 'no environment'); + TODO: { + local $TODO = 'directory brackets look like pattern brackets to glob' if $^O eq 'VMS'; + local $ENV{HOME}; + delete $ENV{HOME}; + local $ENV{USERPROFILE}; + delete $ENV{USERPROFILE}; + $tilde_check->(defined $passwd_home ? $passwd_home : q{~}, 'no environment'); } SKIP: { - skip 'MSWin32 only', 1 if $^O ne 'MSWin32'; - local %ENV = %ENV; - delete $ENV{HOME}; - $ENV{USERPROFILE} = 'sweet win32 home'; - $tilde_check->(defined $passwd_home ? $passwd_home : $ENV{USERPROFILE}, 'USERPROFILE'); + skip 'MSWin32 only', 1 if $^O ne 'MSWin32'; + local $ENV{HOME}; + delete $ENV{HOME}; + local $ENV{USERPROFILE}; + $ENV{USERPROFILE} = 'sweet win32 home'; + $tilde_check->(defined $passwd_home ? $passwd_home : $ENV{USERPROFILE}, 'USERPROFILE'); } - my $home = exists $ENV{HOME} ? $ENV{HOME} - : eval { getpwuid($>); 1 } ? (getpwuid($>))[7] - : $^O eq 'MSWin32' && exists $ENV{USERPROFILE} ? $ENV{USERPROFILE} - : q{~}; - $tilde_check->($home); + TODO: { + local $TODO = 'directory brackets look like pattern brackets to glob' if $^O eq 'VMS'; + my $home = exists $ENV{HOME} ? $ENV{HOME} + : eval { getpwuid($>); 1 } ? (getpwuid($>))[7] + : $^O eq 'MSWin32' && exists $ENV{USERPROFILE} ? $ENV{USERPROFILE} + : q{~}; + $tilde_check->($home); + } } # check backslashing @@ -158,9 +164,11 @@ print "# @a\n"; is_deeply(\@a, [($vms_mode ? 'test.' : 'TEST'), 'a', 'b']); # "~" should expand to $ENV{HOME} -$ENV{HOME} = "sweet home"; -@a = bsd_glob('~', GLOB_TILDE | GLOB_NOMAGIC); -is_deeply(\@a, [$ENV{HOME}]); +{ + local $ENV{HOME} = "sweet home"; + @a = bsd_glob('~', GLOB_TILDE | GLOB_NOMAGIC); + is_deeply(\@a, [$ENV{HOME}]); +} # GLOB_ALPHASORT (default) should sort alphabetically regardless of case mkdir "pteerslo", 0777; -- Perl5 Master Repository
