Eric Wilhelm wrote:
This is really an ill-formed idea right now but:
($stdout, $stderr, $code) = run_prog($prog, '--arg' , 'val'); ok($stdout eq "arg -> val"); ($stdout, $stderr, $code) = run_prog($prog, '--nonarg' , 'val'); ok($code == 1); # error code (as expected) ($stdout, $stderr, $code) = run_prog($prog, '--help' , 'arg'); ok($stderr =~ m/arg/); # help messages on stderr
I'm not sure if there's a test module that already does this or not. Any suggestions? (maybe Test::Cmd))
--Eric
Check out Test::Output. That combined with system() might do what you need.
David