File: findorule.t

package info (click to toggle)
libfile-find-object-rule-perl 0.0300-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 168 kB
  • ctags: 44
  • sloc: perl: 1,281; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 1,070 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
#!perl

use strict;
use warnings;

use Test::More tests => 6;
use File::Spec;

# extra tests for findorule.  these are more for testing the parsing code.

sub run ($) {
    my $expr = shift;
    my $script = File::Spec->catfile(
        File::Spec->curdir(), "scripts", "findorule"
    );

    [ sort split /\n/, `$^X -Mblib $script $expr 2>&1` ];
}

is_deeply(run 't -file -name foobar', [ 't/foobar' ],
          '-file -name foobar');

is_deeply(run 't -maxdepth 0 -directory',
          [ 't' ], 'last clause has no args');


{
    local $TODO = "Win32 cmd.exe hurts my brane"
      if ($^O =~ m/Win32/ || $^O eq 'dos');

    is_deeply(run 't -file -name \( foobar \*.t \)',
              [ qw( t/File-Find-Rule.t t/findorule.t t/foobar ) ],
              'grouping ()');

    is_deeply(run 't -name \( -foo foobar \)',
              [ 't/foobar' ], 'grouping ( -literal )');
}

is_deeply(run 't -file -name foobar baz',
          [ "unknown option 'baz'" ], 'no implicit grouping');

is_deeply(run 't -maxdepth 0 -name -file',
          [], 'terminate at next -');