This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Convert all File::Glob tests to Test::More.
[perl5.git] / ext / File-Glob / t / case.t
CommitLineData
220398a0
PM
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
1d89eaef 5 @INC = '../lib';
d2a01882
GS
6 require Config; import Config;
7 if ($Config{'extensions'} !~ /\bFile\/Glob\b/i) {
8 print "1..0\n";
9 exit 0;
10 }
220398a0 11}
92361f5e
NC
12
13use Test::More tests => 7;
14
15BEGIN {
16 use_ok('File::Glob', qw(:glob csh_glob));
220398a0 17}
220398a0 18
1d89eaef 19my $pat = "op/G*.t";
7369a524 20
220398a0 21import File::Glob ':nocase';
b695f709 22@a = csh_glob($pat);
92361f5e 23cmp_ok(scalar @a, '>=', 8, 'use of the case sensitivity tags, via csh_glob()');
220398a0
PM
24
25# This may fail on systems which are not case-PRESERVING
26import File::Glob ':case';
92361f5e
NC
27@a = csh_glob($pat);
28is(scalar @a, 0, 'None should be uppercase');
220398a0 29
7369a524 30@a = bsd_glob($pat, GLOB_NOCASE);
92361f5e 31cmp_ok(scalar @a, '>=', 3, 'explicit use of the GLOB_NOCASE flag');
220398a0
PM
32
33# Test Win32 backslash nastiness...
92361f5e
NC
34SKIP: {
35 skip 'Not Win32 or NetWare', 3 unless $^O eq 'MSWin32' || $^O eq 'NetWare';
36
b695f709 37 @a = File::Glob::glob("op\\g*.t");
92361f5e 38 cmp_ok(scalar @a, '>=', 8);
220398a0
PM
39 mkdir "[]", 0;
40 @a = File::Glob::glob("\\[\\]", GLOB_QUOTE);
41 rmdir "[]";
92361f5e 42 is(scalar @a, 1);
b695f709 43 @a = bsd_glob("op\\*", GLOB_QUOTE);
92361f5e 44 isnt(scalar @a, 0);
220398a0 45}