@@ -17,41 +17,41 @@ our ($warning, $opt_f, $opt_i, $opt_o, $opt_x, $opt_y, %opt);
1717@ARGV = qw( -xo -f foo -y file) ;
1818getopt(' f' );
1919
20- is( " @ARGV " , ' file' , ' options removed from @ARGV (1)' );
20+ is( " @ARGV " , ' file' , ' options removed from @ARGV (1)' );
2121ok( $opt_x && $opt_o && $opt_y , ' options -x, -o and -y set' );
22- is( $opt_f , ' foo' , q/ option -f is 'foo'/ );
22+ is( $opt_f , ' foo' , q/ option -f is 'foo'/ );
2323
2424@ARGV = qw( -hij k -- -l m -n) ;
2525getopt ' il' , \%opt ;
2626
27- is( " @ARGV " , ' k -- -l m -n' , ' options removed from @ARGV (2)' );
28- ok( $opt {h } && $opt {i } eq ' j' , ' option -h and -i correctly set' );
29- ok( !defined $opt {l }, ' option -l not set' );
30- ok( !defined $opt_i , ' $opt_i still undefined' );
27+ is( " @ARGV " , ' k -- -l m -n' , ' options removed from @ARGV (2)' );
28+ ok( $opt {h } && $opt {i } eq ' j' , ' option -h and -i correctly set' );
29+ ok( !defined $opt {l }, ' option -l not set' );
30+ ok( !defined $opt_i , ' $opt_i still undefined' );
3131
3232# Then we try the getopts
3333$opt_o = $opt_i = $opt_f = undef ;
3434@ARGV = qw( -foi -i file) ;
3535
36- ok( getopts(' oif:' ), ' getopts succeeded (1)' );
37- is( " @ARGV " , ' file' , ' options removed from @ARGV (3)' );
38- ok( $opt_i && $opt_f eq ' oi' , ' options -i and -f correctly set' );
39- ok( !defined $opt_o , ' option -o not set' );
36+ ok( getopts(' oif:' ), ' getopts succeeded (1)' );
37+ is( " @ARGV " , ' file' , ' options removed from @ARGV (3)' );
38+ ok( $opt_i && $opt_f eq ' oi' , ' options -i and -f correctly set' );
39+ ok( !defined $opt_o , ' option -o not set' );
4040
4141%opt = (); $opt_i = undef ;
4242@ARGV = qw( -hij -k -- -l m) ;
4343
44- ok( getopts(' hi:kl' , \%opt ), ' getopts succeeded (2)' );
45- is( " @ARGV " , ' -l m' , ' options removed from @ARGV (4)' );
46- ok( $opt {h } && $opt {k }, ' options -h and -k set' );
47- is( $opt {i }, ' j' , q/ option -i is 'j'/ );
48- ok( !defined $opt_i , ' $opt_i still undefined' );
44+ ok( getopts(' hi:kl' , \%opt ), ' getopts succeeded (2)' );
45+ is( " @ARGV " , ' -l m' , ' options removed from @ARGV (4)' );
46+ ok( $opt {h } && $opt {k }, ' options -h and -k set' );
47+ is( $opt {i }, ' j' , q/ option -i is 'j'/ );
48+ ok( !defined $opt_i , ' $opt_i still undefined' );
4949
5050# Try illegal options, but avoid printing of the error message
5151$SIG {__WARN__ } = sub { $warning = $_ [0] };
5252@ARGV = qw( -h help) ;
5353
54- ok( !getopts(" xf:y" ), ' getopts fails for an illegal option' );
54+ ok( !getopts(" xf:y" ), ' getopts fails for an illegal option' );
5555ok( $warning eq " Unknown option: h\n " , ' user warned' );
5656
5757# Tests for RT #41359
0 commit comments