X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F101_argv_bug.t;h=6d75ad56d08237135f288d9c771d8e3888272fae;hb=02f7240001316f154a703fa8e28a50f432f1c90d;hp=1a84cecc5cd0670f5ce81c43bb009d9920e809d1;hpb=f7655c45b040d61c8e6aa2e588542977c0368f36;p=gitmo%2FMooseX-Getopt.git diff --git a/t/101_argv_bug.t b/t/101_argv_bug.t index 1a84cec..6d75ad5 100644 --- a/t/101_argv_bug.t +++ b/t/101_argv_bug.t @@ -1,99 +1,37 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 3; -BEGIN { - # TEST - use_ok('MooseX::Getopt'); -} +use MooseX::Getopt; { package App; use Moose; - - with 'MooseX::Getopt'; - has 'data' => ( - metaclass => 'MooseX::Getopt::Meta::Attribute', - is => 'ro', - isa => 'Str', - default => 'file.dat', - cmd_flag => 'f', - ); - - has 'cow' => ( - metaclass => 'Getopt', - is => 'ro', - isa => 'Str', - default => 'moo', - cmd_aliases => [qw/ moocow m c /], - ); - - has 'horse' => ( - metaclass => 'MooseX::Getopt::Meta::Attribute', - is => 'ro', - isa => 'Str', - default => 'bray', - cmd_flag => 'horsey', - cmd_aliases => 'x', - ); + with 'MooseX::Getopt'; has 'length' => ( is => 'ro', isa => 'Int', - default => 24 + default => 24, ); has 'verbose' => ( is => 'ro', - isa => 'Bool', - ); - - has 'libs' => ( - is => 'ro', - isa => 'ArrayRef', - default => sub { [] }, - ); - - has 'details' => ( - is => 'ro', - isa => 'HashRef', - default => sub { {} }, - ); - - has '_private_stuff' => ( - is => 'ro', - isa => 'Int', - default => 713 - ); - - has '_private_stuff_cmdline' => ( - metaclass => 'MooseX::Getopt::Meta::Attribute', - is => 'ro', - isa => 'Int', - default => 832, - cmd_flag => 'p', + isa => 'Bool', + default => 0, ); - + no Moose; } { my $app = App->new_with_options(argv => [ '--verbose', '--length', 50 ]); - # TEST isa_ok($app, 'App'); - # TEST ok($app->verbose, '... verbosity is turned on as expected'); - # TEST - is($app->length, 50, '... length is 50 as expected'); - # TEST - is($app->data, 'file.dat', '... data is file.dat as expected'); - # TEST - is_deeply($app->libs, [], '... libs is [] as expected'); - # TEST - is_deeply($app->details, {}, '... details is {} as expected'); + is($app->length, 50, '... length is 50 as expected'); }