File: TestHelper.pm

package info (click to toggle)
libdist-zilla-plugin-run-perl 0.050-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 444 kB
  • sloc: perl: 580; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 827 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
use strict;
use warnings;

# compare pathnames for equality - / and \ are treated identically
sub is_path
{
    goto \&Test::More::is if $^O ne 'MSWin32';

    my ($got, $want, $test_name) = @_;

    $got =~ s{\\}{/}g;

    $test_name ||= 'path name matches';
    $test_name .= ' (where / and \\ are considered identical)';

    local $Test::Builder::Level = $Test::Builder::Level + 1;
    is($got, $want, $test_name);
}

# compare pathname to regex - / and \ are treated identically
sub like_path
{
    goto \&Test::More::like if $^O ne 'MSWin32';

    my ($got, $want_re, $test_name) = @_;

    $got =~ s{\\}{/}g;

    $test_name ||= 'path name matches';
    $test_name .= ' (where / and \\ are considered identical)';

    local $Test::Builder::Level = $Test::Builder::Level + 1;
    like($got, $want_re, $test_name);
}

1;