File: input.t

package info (click to toggle)
libio-all-perl 0.39-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 536 kB
  • ctags: 331
  • sloc: perl: 2,761; makefile: 5
file content (49 lines) | stat: -rw-r--r-- 1,131 bytes parent folder | download | duplicates (3)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
use lib 't', 'lib';
use strict;
use warnings;
use Test::More tests => 12;
use IO::All;
use IO_All_Test;

io('t/input.t') > my $contents;
test_file_contents($contents, 't/input.t');

$contents < io 't/input.t';
test_file_contents($contents, 't/input.t');

my $io = io 't/input.t';
$contents = $$io;
test_file_contents($contents, 't/input.t');

$contents = $io->slurp;
test_file_contents($contents, 't/input.t');

$contents = $io->scalar;
test_file_contents($contents, 't/input.t');

$contents = join '', $io->getlines;
test_file_contents($contents, 't/input.t');

SKIP: {
    eval {require Tie::File};
    skip "requires Tie::File", 2	if $@;

    $io->rdonly;
    $contents = join '', map "$_\n", @$io;
    test_file_contents($contents, 't/input.t');
    $io->close;

    $io->tie;
    $contents = join '', <$io>;
    test_file_contents($contents, 't/input.t');
}

my @lines = io('t/input.t')->slurp;
ok(@lines > 36);
test_file_contents(join('', @lines), 't/input.t');

my $old_contents = $contents;
$contents << io('t/input.t');
is($contents, $old_contents . $old_contents);

is(io('t/input.t') >> $contents, ($old_contents x 3));