tagged release 0.6.4
[parrot.git] / languages / pipp / t / php / filestat.t
blob4e4f4cfcf9c5761e84b36c0339cc66675289afe9
1 #! perl
2 # Copyright (C) 2008, The Perl Foundation.
3 # $Id$
5 =head1 NAME
7 t/php/filestat.t - Standard Library filestat
9 =head1 SYNOPSIS
11     % perl -I../lib pipp/t/php/filestat.t
13 =head1 DESCRIPTION
15 Tests PHP Standard Library file
16 (implemented in F<languages/pipp/src/common/php_filestat.pir>).
18 See L<http://www.php.net/manual/en/ref.filesystem.php>.
20 =cut
22 use strict;
23 use warnings;
25 use FindBin;
26 use lib "$FindBin::Bin/../../lib";
28 use Test::More     tests => 3;
29 use Parrot::Test;
32 unlink 'pipp/file.txt' if (-f 'pipp/file.txt');
34 language_output_is( 'Pipp', <<'CODE', <<'OUTPUT', 'file_exists()' );
35 <?php
36   echo file_exists('file.txt'), "\n";
38 CODE
40 OUTPUT
42 open my $X, '>', 'pipp/file.txt';
43 binmode $X, ':raw';
44 print {$X} "line 1\n";
45 print {$X} "line 2\n";
46 print {$X} "line 3\n";
47 close $X;
49 language_output_is( 'Pipp', <<'CODE', <<'OUTPUT', 'file_exists()' );
50 <?php
51   echo file_exists('file.txt'), "\n";
53 CODE
55 OUTPUT
57 language_output_is( 'Pipp', <<'CODE', <<'OUTPUT', 'filesize()' );
58 <?php
59   echo filesize('file.txt'), "\n";
61 CODE
63 OUTPUT
65 unlink 'pipp/file.txt' if (-f 'pipp/file.txt');
68 # Local Variables:
69 #   mode: cperl
70 #   cperl-indent-level: 4
71 #   fill-column: 100
72 # End:
73 # vim: expandtab shiftwidth=4: