* MooseX::Getopt::Parser::Descriptive: fixed regression: does not require CLI param...
[gitmo/MooseX-Getopt.git] / t / 001_basic.t
index 3b171a1..48dca21 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 173;
+use Test::More tests => 185;
 
 BEGIN {
     use_ok('MooseX::Getopt');
@@ -319,3 +319,30 @@ foreach my $parser_name (qw(MooseX::Getopt::Parser::Long MooseX::Getopt::Parser:
 
     }
 }
+
+# Test default parser
+{
+    local @ARGV = ();
+
+    my $app = App->new_with_options;
+    isa_ok($app, 'App');
+
+    ok(!$app->verbose, '... verbosity is off as expected');
+    is($app->length, 24, '... length is 24 as expected');
+    is($app->data, 'file.dat', '... data is file.dat as expected');
+    is_deeply($app->libs, [], '... libs is [] as expected');
+    is_deeply($app->details, {}, '... details is {} as expected');
+}
+
+{
+    local @ARGV = ('--verbose', '--length', 50);
+
+    my $app = App->new_with_options;
+    isa_ok($app, 'App');
+
+    ok($app->verbose, '... verbosity is turned on as expected');
+    is($app->length, 50, '... length is 50 as expected');
+    is($app->data, 'file.dat', '... data is file.dat as expected');
+    is_deeply($app->libs, [], '... libs is [] as expected');
+    is_deeply($app->details, {}, '... details is {} as expected');
+}