1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#!/usr/bin/perl
use warnings;
use strict;
use Test::More qw(no_plan);
use File::Fu;
my $d = File::Fu->dir->temp_dir('tmp.');
my $f = $d + 'file';
is($f->basename, 'file');
my $fh = $f->open('>');
print $fh "foo\nbar\n";
close($fh) or die "cannot write '$f' $!";
ok($f->e);
my @lines = $f->read;
is_deeply(\@lines, ["foo\n", "bar\n"], 'slurp array');
is($f->read, "foo\nbar\n", 'slurp scalar');
# TODO something where File::Slurp is not loaded
# (probably in another test file and messing with @INC)
# vim:ts=2:sw=2:et:sta
|