Move Test::Harness from ext/ to cpan/
[p5sagit/p5-mst-13.2.git] / cpan / Test-Harness / t / glob-to-regexp.t
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use Test::More;
6
7 require TAP::Parser::Scheduler;
8
9 my @tests;
10 while (<DATA>) {
11     my ( $glob, $pattern, $name ) = /^(\S+)\t+(\S+)(?:\t+(.*))?$/;
12     die "'$_'" unless $pattern;
13     push @tests, [ $glob, $pattern, $name ];
14 }
15
16 plan tests => scalar @tests;
17
18 foreach (@tests) {
19     my ( $glob, $pattern, $name ) = @$_;
20     is( TAP::Parser::Scheduler->_glob_to_regexp($glob), $pattern,
21         defined $name ? "$glob  -- $name" : $glob
22     );
23 }
24 __DATA__
25 Pie                     Pie
26 *.t                     [^/]*\.t
27 **.t                    .*?\.t
28 A?B                     A[^/]B
29 */*.t                   [^/]*\/[^/]*\.t
30 A,B                     A\,B                            , outside {} not special
31 {A,B}                   (?:A|B)
32 A{B}C                   A(?:B)C
33 A{B,C}D                 A(?:B|C)D
34 A{B,C,D}E{F,G,H}I,J     A(?:B|C|D)E(?:F|G|H)I\,J
35 {Perl,Rules}            (?:Perl|Rules)
36 A}B                     A\}B                            Bare } corner case
37 A{B,C}D}E               A(?:B|C)D\}E
38 },A{B,C}D},E            \}\,A(?:B|C)D\}\,E
39 {A{1,2},D{3,4}}         (?:A(?:1|2)|D(?:3|4))
40 {A,{B,C},D}             (?:A|(?:B|C)|D)
41 A{B,C\}D,E\,F}G         A(?:B|C\}D|E\,F)G
42 A\\B                    A\\B
43 A(B)C                   A\(B\)C
44 1{A(B)C,D|E}2           1(?:A\(B\)C|D\|E)2