Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fudged for niecza.
  • Loading branch information
colomon committed Oct 26, 2011
1 parent 45800f1 commit c3a585e
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions S16-filehandles/filetest.t
Expand Up @@ -21,6 +21,7 @@ if $*OS eq "browser" {
# L<S03/Changes to Perl 5 operators/The filetest operators are gone.>
# old: L<S16/Filehandles, files, and directories/A file test, where X is one of the letters listed below.>

#?niecza todo
dies_ok { 't' ~~ :d }, 'file test from before spec revision 27503 is error';

# Basic tests
Expand Down Expand Up @@ -68,6 +69,7 @@ ok not 'doesnotexist.t'.IO ~~ :w, "~~:w returns false on non-existent files";
ok not 'doesnotexist.t'.IO ~~ :x, "~~:x returns false on non-existent files";
ok not 'doesnotexist.t'.IO ~~ :f, "~~:f returns false on non-existent files";

#?niecza skip ".s NYI"
ok($*PROGRAM_NAME.IO.s > 42, "~~:s returns size on existent files");

nok "doesnotexist.t".IO ~~ :s, "~~:s returns false on non-existent files";
Expand All @@ -78,36 +80,40 @@ nok "t".IO ~~ :z, "~~:z returns false on directories";

my $fh = open("empty_file", :w);
close $fh;
#?niecza todo
ok "empty_file".IO ~~ :z, "~~:z returns true for an empty file";
unlink "empty_file";

if $*OS eq any <MSWin32 mingw msys cygwin> {
skip "~~:M/~~:C/~~:A not working on Win32 yet", 9
}
else {
my $fn = 'test_file_filetest_t';
my $fh = open($fn, :w);
close $fh;
sleep 1; # just to make sure
#?rakudo 3 skip ':M, :C, :A'
ok ($fn.IO ~~ :M) < 0, "~~:M works on new file";
ok ($fn.IO ~~ :C) < 0, "~~:C works on new file";
ok ($fn.IO ~~ :A) < 0, "~~:A works on new file";
unlink $fn;

if "README".IO !~~ :f {
skip "no file README", 3;
} else {
#?rakudo 3 skip ':M, :C, :A'
ok ("README".IO ~~ :M) > 0, "~~:M works on existing file";
ok ("README".IO ~~ :C) > 0, "~~:C works on existing file";
ok ("README".IO ~~ :A) > 0, "~~:A works on existing file";
#?niecza skip "Asynchronous programming NYI exception generated"
{
if $*OS eq any <MSWin32 mingw msys cygwin> {
skip "~~:M/~~:C/~~:A not working on Win32 yet", 9
}
else {
my $fn = 'test_file_filetest_t';
my $fh = open($fn, :w);
close $fh;
sleep 1; # just to make sure
#?rakudo 3 skip ':M, :C, :A'
ok ($fn.IO ~~ :M) < 0, "~~:M works on new file";
ok ($fn.IO ~~ :C) < 0, "~~:C works on new file";
ok ($fn.IO ~~ :A) < 0, "~~:A works on new file";
unlink $fn;

if "README".IO !~~ :f {
skip "no file README", 3;
} else {
#?rakudo 3 skip ':M, :C, :A'
ok ("README".IO ~~ :M) > 0, "~~:M works on existing file";
ok ("README".IO ~~ :C) > 0, "~~:C works on existing file";
ok ("README".IO ~~ :A) > 0, "~~:A works on existing file";
}

#?rakudo 3 skip ':M, :C, :A'
ok not "xyzzy".IO ~~ :M, "~~:M returns undefined when no file";
ok not "xyzzy".IO ~~ :C, "~~:C returns undefined when no file";
ok not "xyzzy".IO ~~ :A, "~~:A returns undefined when no file";
#?rakudo 3 skip ':M, :C, :A'
ok not "xyzzy".IO ~~ :M, "~~:M returns undefined when no file";
ok not "xyzzy".IO ~~ :C, "~~:C returns undefined when no file";
ok not "xyzzy".IO ~~ :A, "~~:A returns undefined when no file";
}
}

# potential parsing difficulties (pugs)
Expand Down

0 comments on commit c3a585e

Please sign in to comment.