File: write_file.t

package info (click to toggle)
libtest-base-perl 0.89-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 676 kB
  • sloc: perl: 936; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (4)
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
26
27
28
29
30
31
32
33
34
35
36
use strict;
use lib -e 't' ? 't' : 'test';

use TestBaseTest;

if (-e 't') {
    plan tests => 4;
}
else {
    plan skip_all => "Dist test only";
}


my $t = -e 't' ? 't' : 'test';
my $file = "$t/output/foo.txt";

ok not(-e $file), "$file doesn't already exist";

first_block;

ok -e $file, "$file exists";

open my $fh, $file
  or die "Can't open '$file' for input:\n$!";
is join('', <$fh>),
   "One two\nBuckle my shoe\n",
   '$file content is right';

is first_block->poem, $file, 'Returns file name';

__END__

===
--- poem write_file=t/output/foo.txt
One two
Buckle my shoe