4 use Test::More tests => 7;
9 use_ok('MooseX::Getopt');
16 with 'MooseX::Getopt::Dashes';
18 has 'some_thingy' => ( is => 'ro', isa => 'Str', default => 'foo' );
19 has 'another_thingy' => ( is => 'ro', isa => 'Str', default => 'foo', cmd_flag => 'another_thingy', traits => [ 'Getopt' ], );
23 local @ARGV = (qw/--some-thingy bar/);
24 ok ! exception { is( App->new_with_options->some_thingy, 'bar') }, 'Dash in option name';
28 local @ARGV = (qw/--some_thingy bar/);
29 like exception { App->new_with_options }, qr/Unknown option: some_thingy/;
33 local @ARGV = (qw/--another_thingy bar/);
34 ok ! exception { is( App->new_with_options->another_thingy, 'bar' ) }, 'Underscore in option name';
38 local @ARGV = (qw/--another-thingy bar/);
39 like exception { App->new_with_options }, qr/Unknown option: another-thingy/;