--- lib/PXElator/t/file.t 2009/08/25 17:39:28 289 +++ lib/PXElator/t/file.t 2009/08/26 08:43:40 290 @@ -4,7 +4,7 @@ use strict; use autodie; -use Test::More tests => 11; +use Test::More tests => 17; use Data::Dump qw/dump/; use_ok 'file'; @@ -21,6 +21,16 @@ cmp_ok( -s $file, '>', $size, 'size bigger' ); ok( ! file::change( $file, 'test' => 'foobar' ), 'change again' ); -ok( file::replace( $file, 'replaced content' ), 'replace' ); +ok( file::replace( $file, 'foobar' => 'replaced content' ), 'replace' ); + +my $file2 = $file . '.2'; + +ok( file::copy_once( '/etc/rc.local', $file2 ), 'copy_once' ); +cmp_ok( -s $file2, '==', -s '/etc/rc.local', 'size' ); +ok( file::append( $file2, '# foobar' ), 'append to rc.local' ); +ok( my $content = file::read_file($file2), 'read' ); +like( $content, qr/foobar.*exit/s, 'foobar before exit' ); + +ok( unlink($file2), 'unlink' ); ok( unlink($file), 'unlink' );