~ubuntu-branches/ubuntu/maverick/libfile-fu-perl/maverick

« back to all changes in this revision

Viewing changes to t/slurp.t

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Yu
  • Date: 2009-07-25 07:10:04 UTC
  • Revision ID: james.westby@ubuntu.com-20090725071004-p7cmwowvpf0f7k81
Tags: upstream-0.0.6
ImportĀ upstreamĀ versionĀ 0.0.6

Show diffs side-by-side

added added

removed removed

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