This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Getopt::Long 2.36
[perl5.git] / lib / Getopt / Long / t / gol-basic.t
CommitLineData
1a505819
GS
1#!./perl -w
2
554627f6
RGS
3no strict;
4
36e6c0f5 5BEGIN {
10933be5
RGS
6 if ($ENV{PERL_CORE}) {
7 @INC = '../lib';
8 chdir 't';
9 }
36e6c0f5
JH
10}
11
10e5c9cc 12use Getopt::Long qw(:config no_ignore_case);
554627f6
RGS
13my $want_version="2.24";
14die("Getopt::Long version $want_version required--this is only version ".
10e5c9cc 15 $Getopt::Long::VERSION)
554627f6 16 unless $Getopt::Long::VERSION ge $want_version;
1a505819
GS
17
18print "1..9\n";
19
20@ARGV = qw(-Foo -baR --foo bar);
1a505819
GS
21undef $opt_baR;
22undef $opt_bar;
8de02997 23print (GetOptions("foo", "Foo=s") ? "" : "not ", "ok 1\n");
1a505819
GS
24print ((defined $opt_foo) ? "" : "not ", "ok 2\n");
25print (($opt_foo == 1) ? "" : "not ", "ok 3\n");
26print ((defined $opt_Foo) ? "" : "not ", "ok 4\n");
27print (($opt_Foo eq "-baR") ? "" : "not ", "ok 5\n");
28print ((@ARGV == 1) ? "" : "not ", "ok 6\n");
29print (($ARGV[0] eq "bar") ? "" : "not ", "ok 7\n");
30print (!(defined $opt_baR) ? "" : "not ", "ok 8\n");
31print (!(defined $opt_bar) ? "" : "not ", "ok 9\n");