add MooseX::Getopt::Dashes
[gitmo/MooseX-Getopt.git] / t / 010_dashes.t
diff --git a/t/010_dashes.t b/t/010_dashes.t
new file mode 100644 (file)
index 0000000..4ec1248
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use Test::Exception;
+
+
+BEGIN {
+       use_ok('MooseX::Getopt');
+}
+
+{
+       package App;
+       use Moose;
+
+       with 'MooseX::Getopt::Dashes';
+
+       has 'some_thingy' => ( is => 'ro', isa => 'Str', default => 'foo' );
+}
+
+{
+       local @ARGV = (qw/--some-thingy bar/);
+    lives_and { is( App->new_with_options->some_thingy, 'bar') } 'Dash in option name';
+}
+
+{
+    local @ARGV = (qw/--some_thingy bar/);
+    throws_ok { App->new_with_options } qr/Unknown option: some_thingy/;
+}