This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Getopt::Long 2.32_05
[perl5.git] / lib / Getopt / Long / t / gol-linkage.t
1 #!./perl -w
2
3 BEGIN {
4     if ($ENV{PERL_CORE}) {
5         @INC = '../lib';
6         chdir 't';
7     }
8 }
9
10 use Getopt::Long;
11
12 print "1..18\n";
13
14 @ARGV = qw(-Foo -baR --foo bar);
15 Getopt::Long::Configure ("no_ignore_case");
16 %lnk = ();
17 print "ok 1\n" if GetOptions (\%lnk, "foo", "Foo=s");
18 print ((defined $lnk{foo})   ? "" : "not ", "ok 2\n");
19 print (($lnk{foo} == 1)      ? "" : "not ", "ok 3\n");
20 print ((defined $lnk{Foo})   ? "" : "not ", "ok 4\n");
21 print (($lnk{Foo} eq "-baR") ? "" : "not ", "ok 5\n");
22 print ((@ARGV == 1)          ? "" : "not ", "ok 6\n");
23 print (($ARGV[0] eq "bar")   ? "" : "not ", "ok 7\n");
24 print (!(exists $lnk{baR})   ? "" : "not ", "ok 8\n");
25
26 @ARGV = qw(-Foo -baR --foo bar);
27 Getopt::Long::Configure ("default","no_ignore_case");
28 %lnk = ();
29 my $foo;
30 print "ok 9\n" if GetOptions (\%lnk, "foo" => \$foo, "Foo=s");
31 print ((defined $foo)        ? "" : "not ", "ok 10\n");
32 print (($foo == 1)           ? "" : "not ", "ok 11\n");
33 print ((defined $lnk{Foo})   ? "" : "not ", "ok 12\n");
34 print (($lnk{Foo} eq "-baR") ? "" : "not ", "ok 13\n");
35 print ((@ARGV == 1)          ? "" : "not ", "ok 14\n");
36 print (($ARGV[0] eq "bar")   ? "" : "not ", "ok 15\n");
37 print (!(exists $lnk{foo})   ? "" : "not ", "ok 16\n");
38 print (!(exists $lnk{baR})   ? "" : "not ", "ok 17\n");
39 print (!(exists $lnk{bar})   ? "" : "not ", "ok 18\n");