use strict;
use warnings;
-use Test::More 0.88;
-use Test::Fatal;
+
+use Test::More tests => 9;
+use Test::Trap;
+use Test::NoWarnings 1.04 ':early';
{
package MyScript;
{
local $MyScript::usage; local @MyScript::warnings; local @MyScript::exception;
local @ARGV = ('--help');
- like exception { MyScript->new_with_options }, qr/A foo/;
+ trap { MyScript->new_with_options };
+ like($trap->stdout, qr/A foo/);
is $MyScript::usage, 1;
}
{
local $MyScript::usage; local @MyScript::warnings; local @MyScript::exception;
local @ARGV = ('-q'); # Does not exist
- like exception { MyScript->new_with_options }, qr/A foo/;
+ trap { MyScript->new_with_options };
+ like($trap->die, qr/A foo/);
is_deeply \@MyScript::warnings, [
'Unknown option: q
'
];
+ # FIXME - it looks like we have a spacing issue in Getopt::Long?
my $exp = [
'Unknown option: q
',
- qq{usage: 104_override_usage.t [-?] [long options...]
-\t-? --usage --help Prints this usage information.
-\t--foo A foo
+ qq{usage: 104_override_usage.t [-?h] [long options...]
+\t-h -? --usage --help Prints this usage information.
+\t--foo A foo
}
];
is_deeply \@MyScript::exception, $exp;
}
-done_testing;
-