File: input.t

package info (click to toggle)
libio-all-perl 0.87-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 712 kB
  • sloc: perl: 2,017; makefile: 5
file content (50 lines) | stat: -rw-r--r-- 1,190 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use strict; use warnings;
my $t; use lib ($t = -e 't' ? 't' : 'test');
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));

del_output_dir();