# declare test inputs and expected outputs # # KEY MEANING DEFAULT # # -basename 1st part of subtest name undef # -name 2nd part of subtest name undef # # -skip don't test if 1 undef # # -inparms parms passed to sub under test empty list () # -argv @ARGV set before call untouched # -env %ENV set before call untouched # # -return return from sub under test 1 # # -stdout STDOUT don't test # -string exact string eq # -regex regex against # -matches number of regex matches 1 # -lines number of lines captured # # -stderr STDERR don't test # # -evalerr eval error $@ 0 (no error) # my @test_data = ( # test options parsing by Getopt::Long # if *only* a bad @ARGV then no %options should be parsed out { -name => 'foobar-opt', -argv => [ 'foobar' ], # bad argument -inparms => [ $opt_flag ], # abort with \%options -return => {}, # empty hashref in return -stdout => 0, # expect exactly nothing # -dump => 1, }, # error conditions { -name => 'foobar', -argv => [ 'foobar' ], # bad argument -inparms => [ ], # normal execution -return => 0, # perl failure -stdout => 0, # expect exactly nothing -stderr => { -regex => [ qw{ bad command line usage hump help} ], -matches => 6, -lines => 3, }, # -dump => 1, }, { -name => '-hh(help)-disp', -inparms => [ $disp_flag ], # abort with $dispatch -return => [ q{h}, q{help} ], # $dispatch, $do_parm -stdout => 0, # expect exactly nothing -stderr => 0, # expect exactly nothing }, );