remove useless shebangs in tests
[gitmo/MooseX-Getopt.git] / t / 010_dashes.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 7;
5 use Test::Fatal;
6
7
8 BEGIN {
9     use_ok('MooseX::Getopt');
10 }
11
12 {
13     package App;
14     use Moose;
15
16     with 'MooseX::Getopt::Dashes';
17
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' ], );
20 }
21
22 {
23     local @ARGV = (qw/--some-thingy bar/);
24     ok ! exception { is( App->new_with_options->some_thingy, 'bar') }, 'Dash in option name';
25 }
26
27 {
28     local @ARGV = (qw/--some_thingy bar/);
29     like exception { App->new_with_options }, qr/Unknown option: some_thingy/;
30 }
31
32 {
33     local @ARGV = (qw/--another_thingy bar/);
34     ok ! exception { is( App->new_with_options->another_thingy, 'bar' ) }, 'Underscore in option name';
35 }
36
37 {
38     local @ARGV = (qw/--another-thingy bar/);
39     like exception { App->new_with_options }, qr/Unknown option: another-thingy/;
40 }