Commit | Line | Data |
10e5c9cc |
1 | #!./perl -w |
2 | |
36e6c0f5 |
3 | BEGIN { |
10933be5 |
4 | if ($ENV{PERL_CORE}) { |
5 | @INC = '../lib'; |
6 | chdir 't'; |
7 | } |
36e6c0f5 |
8 | } |
9 | |
10e5c9cc |
10 | use Getopt::Long; |
10933be5 |
11 | die("Getopt::Long version 2.23_03 required--this is only version ". |
10e5c9cc |
12 | $Getopt::Long::VERSION) |
10933be5 |
13 | unless $Getopt::Long::VERSION ge "2.24"; |
10e5c9cc |
14 | print "1..9\n"; |
15 | |
16 | @ARGV = qw(-Foo -baR --foo bar); |
17 | my $p = new Getopt::Long::Parser (config => ["no_ignore_case"]); |
18 | undef $opt_baR; |
19 | undef $opt_bar; |
20 | print "ok 1\n" if $p->getoptions ("foo", "Foo=s"); |
21 | print ((defined $opt_foo) ? "" : "not ", "ok 2\n"); |
22 | print (($opt_foo == 1) ? "" : "not ", "ok 3\n"); |
23 | print ((defined $opt_Foo) ? "" : "not ", "ok 4\n"); |
24 | print (($opt_Foo eq "-baR") ? "" : "not ", "ok 5\n"); |
25 | print ((@ARGV == 1) ? "" : "not ", "ok 6\n"); |
26 | print (($ARGV[0] eq "bar") ? "" : "not ", "ok 7\n"); |
27 | print (!(defined $opt_baR) ? "" : "not ", "ok 8\n"); |
28 | print (!(defined $opt_bar) ? "" : "not ", "ok 9\n"); |