/[pxelator]/lib/PXElator/t/file.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /lib/PXElator/t/file.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 291 - (show annotations)
Wed Aug 26 08:59:50 2009 UTC (14 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1059 byte(s)
test and fix mkdir
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5 use autodie;
6
7 use Test::More tests => 18;
8 use Data::Dump qw/dump/;
9
10 use_ok 'file';
11
12 my $file = '/tmp/test';
13
14 ok( ! -e $file, "$file doesn't exist" );
15 ok( file::append( $file, 'test' ), 'append' );
16 ok( my $size = -s $file, "size" );
17 ok( ! file::append( $file, 'test' ), 'append again' );
18 cmp_ok( -s $file, '==', $size, 'size not changed' );
19
20 ok( file::change( $file, 'test' => 'foobar' ), 'change' );
21 cmp_ok( -s $file, '>', $size, 'size bigger' );
22 ok( ! file::change( $file, 'test' => 'foobar' ), 'change again' );
23
24 ok( file::replace( $file, 'foobar' => 'replaced content' ), 'replace' );
25
26 my $file2 = $file . '.dir/test';
27
28 ok( file::copy_once( '/etc/rc.local', $file2 ), 'copy_once' );
29 cmp_ok( -s $file2, '==', -s '/etc/rc.local', 'size' );
30 ok( file::append( $file2, '# foobar' ), 'append to rc.local' );
31 ok( my $content = file::read_file($file2), 'read' );
32 like( $content, qr/foobar.*exit/s, 'foobar before exit' );
33
34 ok( unlink($file2), 'unlink' );
35 ok( rmdir("$file.dir"), 'rmdir' );
36 ok( unlink($file), 'unlink' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26