#!./perl -wT
chdir 't' if -d 't';
}
# First we test the getopt function
is( "@ARGV", 'file', 'options removed from @ARGV (1)' );
is( "@ARGV", 'k -- -l m -n', 'options removed from @ARGV (2)' );
ok( $opt{h} && $opt{i} eq 'j', 'option -h and -i correctly set' );
# Then we try the getopts
ok( getopts('oif:'), 'getopts succeeded (1)' );
is( "@ARGV", 'file', 'options removed from @ARGV (3)' );
ok( getopts('hi:kl', \%opt), 'getopts succeeded (2)' );
is( "@ARGV", '-l m', 'options removed from @ARGV (4)' );
ok( $opt{h} && $opt{k}, 'options -h and -k set' );
# Try illegal options, but avoid printing of the error message
ok( !getopts("xf:y"), 'getopts fails for an illegal option' );
# Then try the Getopt::Long module
),
'Getopt::Long::GetOptions succeeded'
);
is( "@ARGV", 'file', 'options removed from @ARGV (5)' );