Commit | Line | Data |
5f78e881 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More tests => 3; |
7 | |
8 | use Test::Exception; |
9 | |
10 | |
11 | BEGIN { |
12 | use_ok('MooseX::Getopt'); |
13 | } |
14 | |
15 | { |
16 | package App; |
17 | use Moose; |
18 | |
19 | with 'MooseX::Getopt::Dashes'; |
20 | |
21 | has 'some_thingy' => ( is => 'ro', isa => 'Str', default => 'foo' ); |
22 | } |
23 | |
24 | { |
25 | local @ARGV = (qw/--some-thingy bar/); |
26 | lives_and { is( App->new_with_options->some_thingy, 'bar') } 'Dash in option name'; |
27 | } |
28 | |
29 | { |
30 | local @ARGV = (qw/--some_thingy bar/); |
31 | throws_ok { App->new_with_options } qr/Unknown option: some_thingy/; |
32 | } |