File: 01_basic.t

package info (click to toggle)
libio-file-withpath-perl 0.09-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 192 kB
  • sloc: perl: 1,888; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 677 bytes parent folder | download | duplicates (2)
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
use strict;
use Test::More tests => 6 * 2;

use IO::File::WithPath;
use FindBin;
use File::Spec;

my $absolute_path = File::Spec->rel2abs("$FindBin::Bin/01_basic.t");
my $relative_path = File::Spec->abs2rel($absolute_path);

check(IO::File::WithPath->new($absolute_path));
check(IO::File::WithPath->new($relative_path));


sub check {
    my $f = shift;

    is ref $f => 'IO::File::WithPath';

    ok $f->can('path');
    is $f->path => $absolute_path;

    is $f->getline => "use strict;\n";

    while ( my $line = <$f> ) {
        is $line => "use Test::More tests => 6 * 2;\n";
        last;
    }

    my @lines = <$f>;
    is $lines[1] => "use IO::File::WithPath;\n";
}