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