6 use Test::More tests => 7;
11 use_ok('MooseX::Getopt');
18 with 'MooseX::Getopt::Dashes';
20 has 'some_thingy' => ( is => 'ro', isa => 'Str', default => 'foo' );
21 has 'another_thingy' => ( is => 'ro', isa => 'Str', default => 'foo', cmd_flag => 'another_thingy', traits => [ 'Getopt' ], );
25 local @ARGV = (qw/--some-thingy bar/);
26 ok ! exception { is( App->new_with_options->some_thingy, 'bar') }, 'Dash in option name';
30 local @ARGV = (qw/--some_thingy bar/);
31 like exception { App->new_with_options }, qr/Unknown option: some_thingy/;
35 local @ARGV = (qw/--another_thingy bar/);
36 ok ! exception { is( App->new_with_options->another_thingy, 'bar' ) }, 'Underscore in option name';
40 local @ARGV = (qw/--another-thingy bar/);
41 like exception { App->new_with_options }, qr/Unknown option: another-thingy/;