use strict;
use warnings;
-use Test::More tests => 49;
+use Test::More tests => 69;
BEGIN {
use_ok('MooseX::Getopt');
);
has 'cow' => (
- metaclass => 'MooseX::Getopt::Meta::Attribute',
+ metaclass => 'Getopt',
is => 'ro',
isa => 'Str',
default => 'moo',
}
+foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
+ my $attr = App->meta->get_attribute($attr_name);
+ isa_ok($attr, 'Moose::Meta::Attribute');
+ isa_ok($attr, 'MooseX::Getopt::Meta::Attribute');
+ can_ok($attr, 'cmd_flag');
+ can_ok($attr, 'cmd_aliases');
+}
+
{
local @ARGV = ();
isa_ok($app, 'App');
is($app->_private_stuff_cmdline, 666, '_foo + cmd_flag');
}
+
+# Test ARGV support
+{
+ my @args = ('-p', 12345, '-c', 99, '-');
+ local @ARGV = @args;
+ my $app = App->new_with_options;
+ isa_ok($app, 'App');
+ is_deeply($app->ARGV, \@args, 'ARGV accessor');
+ is_deeply(\@ARGV, \@args, '@ARGV unmangled');
+ is_deeply($app->extra_argv, ['-'], 'extra_argv accessor');
+}