File: case.t

package info (click to toggle)
perl 5.42.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 128,392 kB
  • sloc: perl: 534,963; ansic: 240,563; sh: 72,042; pascal: 6,934; xml: 2,428; yacc: 1,360; makefile: 1,197; cpp: 208; lisp: 1
file content (45 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download
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
44
45
#!./perl

BEGIN {
    chdir 't' if -d 't';
    @INC = '../lib';
    require Config; Config->import;
    if ($Config{'extensions'} !~ /\bFile\/Glob\b/i) {
        print "1..0\n";
        exit 0;
    }
}

use Test::More tests => 7;

BEGIN {
    use_ok('File::Glob', qw(:glob csh_glob));
}

my $pat = "op/G*.t";

File::Glob->import(':nocase');
@a = csh_glob($pat);
cmp_ok(scalar @a, '>=', 8, 'use of the case sensitivity tags, via csh_glob()');

# This may fail on systems which are not case-PRESERVING
File::Glob->import(':case');
@a = csh_glob($pat);
is(scalar @a, 0, 'None should be uppercase');

@a = bsd_glob($pat, GLOB_NOCASE);
cmp_ok(scalar @a, '>=', 3, 'explicit use of the GLOB_NOCASE flag');

# Test Win32 backslash nastiness...
SKIP: {
    skip 'Not Win32', 3 unless $^O eq 'MSWin32';

    @a = File::Glob::bsd_glob("op\\g*.t");
    cmp_ok(scalar @a, '>=', 8);
    mkdir "[]", 0;
    @a = File::Glob::bsd_glob("\\[\\]", GLOB_QUOTE);
    rmdir "[]";
    is(scalar @a, 1);
    @a = bsd_glob("op\\*", GLOB_QUOTE);
    isnt(scalar @a, 0);
}