Commit | Line | Data |
---|---|---|
1a505819 GS |
1 | #!./perl -w |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
5 | unshift @INC, '../lib'; | |
6 | } | |
7 | ||
8 | use Getopt::Long; | |
9 | ||
10 | print "1..18\n"; | |
11 | ||
12 | @ARGV = qw(-Foo -baR --foo bar); | |
13 | Getopt::Long::Configure ("no_ignore_case"); | |
14 | %lnk = (); | |
15 | print "ok 1\n" if GetOptions (\%lnk, "foo", "Foo=s"); | |
16 | print ((defined $lnk{foo}) ? "" : "not ", "ok 2\n"); | |
17 | print (($lnk{foo} == 1) ? "" : "not ", "ok 3\n"); | |
18 | print ((defined $lnk{Foo}) ? "" : "not ", "ok 4\n"); | |
19 | print (($lnk{Foo} eq "-baR") ? "" : "not ", "ok 5\n"); | |
20 | print ((@ARGV == 1) ? "" : "not ", "ok 6\n"); | |
21 | print (($ARGV[0] eq "bar") ? "" : "not ", "ok 7\n"); | |
22 | print (!(exists $lnk{baR}) ? "" : "not ", "ok 8\n"); | |
23 | ||
24 | @ARGV = qw(-Foo -baR --foo bar); | |
25 | Getopt::Long::Configure ("default","no_ignore_case"); | |
26 | %lnk = (); | |
27 | my $foo; | |
28 | print "ok 9\n" if GetOptions (\%lnk, "foo" => \$foo, "Foo=s"); | |
29 | print ((defined $foo) ? "" : "not ", "ok 10\n"); | |
30 | print (($foo == 1) ? "" : "not ", "ok 11\n"); | |
31 | print ((defined $lnk{Foo}) ? "" : "not ", "ok 12\n"); | |
32 | print (($lnk{Foo} eq "-baR") ? "" : "not ", "ok 13\n"); | |
33 | print ((@ARGV == 1) ? "" : "not ", "ok 14\n"); | |
34 | print (($ARGV[0] eq "bar") ? "" : "not ", "ok 15\n"); | |
35 | print (!(exists $lnk{foo}) ? "" : "not ", "ok 16\n"); | |
36 | print (!(exists $lnk{baR}) ? "" : "not ", "ok 17\n"); | |
37 | print (!(exists $lnk{bar}) ? "" : "not ", "ok 18\n"); |