From: Rafael Garcia-Suarez Date: Thu, 22 Oct 2009 20:39:45 +0000 (+0200) Subject: Remove file t/0 added by last commit X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d1c21cecdd89e9b092d8df4a520111183a1d537a;p=p5sagit%2Fp5-mst-13.2.git Remove file t/0 added by last commit Make the test create it instead --- diff --git a/MANIFEST b/MANIFEST index 009b5ec..dd82c52 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4137,7 +4137,6 @@ symbian/uid.pl Helper code for config.pl symbian/version.pl Helper code for config.pl symbian/xsbuild.pl Building extensions taint.c Tainting code -t/0 while(readdir) testing file t/base/cond.t See if conditionals work t/base/if.t See if if works t/base/lex.t See if lexical items work diff --git a/t/0 b/t/0 deleted file mode 100644 index 689e8ce..0000000 --- a/t/0 +++ /dev/null @@ -1,6 +0,0 @@ -This file is here for testing - -while(readdir $dir){...} -... while readdir $dir - -etc diff --git a/t/op/while_readdir.t b/t/op/while_readdir.t index 740bfdd..851c6d7 100644 --- a/t/op/while_readdir.t +++ b/t/op/while_readdir.t @@ -9,14 +9,26 @@ BEGIN { use strict; use warnings; -opendir my $dirhandle, '.' or die "Failed test: unable to open directory\n"; +open my $fh, ">", "0" or die "Can't open '0' for writing: $!\n"; +print $fh <<'FILE0'; +This file is here for testing -my @dir = readdir $dirhandle; -rewinddir $dirhandle; +while(readdir $dir){...} +... while readdir $dir -plan 9; +etc +FILE0 +close $fh; +plan 10; +ok(-f '0', "'0' file is here"); + +opendir my $dirhandle, '.' + or die "Failed test: unable to open directory: $!\n"; + +my @dir = readdir $dirhandle; +rewinddir $dirhandle; { my @list; @@ -62,54 +74,51 @@ plan 9; rewinddir $dirhandle; } -SKIP:{ - skip ('No file named "0"',4) unless (scalar grep{ defined $_ && $_ eq '0' } @dir ); - - { - my $works = 0; - while(readdir $dirhandle){ - if( defined $_ && $_ eq '0'){ - $works = 1; - last; - } - } - ok( $works, 'while(readdir){} with file named "0"' ); - rewinddir $dirhandle; - } - - { - my $works = 0; - my $sub = sub{ - if( defined $_ && $_ eq '0' ){ - $works = 1; - } - }; - $sub->($_) while readdir $dirhandle; - ok( $works, '$sub->($_) while readdir; with file named "0"' ); - rewinddir $dirhandle; - } - - { - my $works = 0; - while( my $dir = readdir $dirhandle ){ - if( defined $dir && $dir eq '0'){ - $works = 1; - last; - } - } - ok( $works, 'while($dir=readdir){} with file named "0"'); - rewinddir $dirhandle; +{ + my $works = 0; + while(readdir $dirhandle){ + if( defined $_ && $_ eq '0'){ + $works = 1; + last; + } } + ok( $works, 'while(readdir){} with file named "0"' ); + rewinddir $dirhandle; +} - { - my $tmp; - my $ok; - my @list; - defined($tmp)&& !$tmp && ($ok=1) while $tmp = readdir $dirhandle; - ok( $ok, '$dir while $dir = readdir; with file named "0"' ); - rewinddir $dirhandle; +{ + my $works = 0; + my $sub = sub{ + if( defined $_ && $_ eq '0' ){ + $works = 1; + } + }; + $sub->($_) while readdir $dirhandle; + ok( $works, '$sub->($_) while readdir; with file named "0"' ); + rewinddir $dirhandle; +} + +{ + my $works = 0; + while( my $dir = readdir $dirhandle ){ + if( defined $dir && $dir eq '0'){ + $works = 1; + last; + } } + ok( $works, 'while($dir=readdir){} with file named "0"'); + rewinddir $dirhandle; +} +{ + my $tmp; + my $ok; + my @list; + defined($tmp)&& !$tmp && ($ok=1) while $tmp = readdir $dirhandle; + ok( $ok, '$dir while $dir = readdir; with file named "0"' ); + rewinddir $dirhandle; } closedir $dirhandle; + +END { 1 while unlink "0" }