This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Silence more deprecation warnings in compatibility tests for Getopt::Long
[perl5.git] / lib / Getopt / Long / t / gol-compat.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
b814bbfa
SM
12{
13 # Silence the deprecation warnings from newgetopt.pl for the purpose
14 # of testing. These tests will be removed along with newgetopt.pl in
15 # the next major release of perl.
16 local $SIG{__WARN__} = sub {
17 if ($_[0] !~ /deprecated/) {
18 print(STDERR @_);
19 }
20 };
21 require "newgetopt.pl";
22}
1a505819
GS
23
24print "1..9\n";
25
26@ARGV = qw(-Foo -baR --foo bar);
27$newgetopt::ignorecase = 0;
28$newgetopt::ignorecase = 0;
29undef $opt_baR;
30undef $opt_bar;
31print "ok 1\n" if NGetOpt ("foo", "Foo=s");
32print ((defined $opt_foo) ? "" : "not ", "ok 2\n");
33print (($opt_foo == 1) ? "" : "not ", "ok 3\n");
34print ((defined $opt_Foo) ? "" : "not ", "ok 4\n");
35print (($opt_Foo eq "-baR") ? "" : "not ", "ok 5\n");
36print ((@ARGV == 1) ? "" : "not ", "ok 6\n");
37print (($ARGV[0] eq "bar") ? "" : "not ", "ok 7\n");
38print (!(defined $opt_baR) ? "" : "not ", "ok 8\n");
39print (!(defined $opt_bar) ? "" : "not ", "ok 9\n");