2 # https://rt.cpan.org/Public/Bug/Display.html?id=47865
3 # https://rt.cpan.org/Public/Bug/Display.html?id=52474
4 # https://rt.cpan.org/Public/Bug/Display.html?id=57683
5 # http://www.nntp.perl.org/group/perl.moose/2010/06/msg1767.html
7 # Summary: If we disable the "auto_help" option in Getopt::Long, then
8 # getoptions() will not call into pod2usage() (causing program termination)
9 # when --help is passed (and MooseX::ConfigFromFile is in use).
14 use Test::Requires { 'MooseX::SimpleConfig' => 0.07 }; # skip all if not installed
15 use Test::More tests => 2;
17 use Test::Fatal 0.003;
19 use Test::NoWarnings 1.04 ':early';
24 use strict; use warnings;
28 'MooseX::SimpleConfig',
31 # this is a hacky way of being able to check that we made it past the
32 # $opt_parser->getoptions() call in new_with_options, because it is
33 # still going to bail out later on, on seeing the --help flag
35 is => 'ro', isa => 'Str',
38 'this_value_unimportant',
47 ok(!$fail_on_exit, 'getoptions() lives');
49 # cancel the non-zero exit status from print_usage_text()
57 like exception { Class->new_with_options },
58 #usage: 107_no_auto_help.t [-?] [long options...]
59 qr/^usage: [\d\w]+\Q.t [-?] [long options...]\E.\s+\Q-? --usage --help Prints this usage information.\E.\s+--configfile/ms,
60 'usage information looks good';
62 qr/^Specified configfile \'this_value_unimportant\' does not exist, is empty, or is not readable$/,
63 'Our dummy config file doesn\'t exist';