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