File: arrayref.t

package info (click to toggle)
libmoosex-types-path-tiny-perl 0.012-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 304 kB
  • sloc: perl: 276; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 907 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
33
34
35
36
37
38
39
40
use strict;
use warnings;
use Test::More 0.88;
use Path::Tiny;
use File::Temp;
use File::pushd qw/tempd/;
use MooseX::Types::Path::Tiny qw/Paths AbsPaths/;

{
    my %tests = (
        "path('foo')"       => path('foo'),
        'foo'               => 'foo',
        "[ path('foo') ]"   => [ path('foo') ],
        "[ 'foo' ]"         => [ 'foo' ],
    );

    foreach my $test (keys %tests)
    {
        ok(is_Paths(to_Paths($tests{$test})), 'can coerce ' . $test . ' to Paths');
    }
}

{
    my $wd = tempd;
    my $tf = File::Temp->new;

    my %tests = (
        'path($filename)'       => path($tf),
        '$filename'             => $tf,
        '[ path($filename) ]'   => [ path($tf) ],
        '[ $filename ]'         => [ $tf ],
    );

    foreach my $test (keys %tests)
    {
        ok(is_AbsPaths(to_AbsPaths($tests{$test})), 'can coerce ' . $test . ' to AbsPaths');
    }
}

done_testing;