From: Tomas Doran (t0m) Date: Thu, 10 Dec 2009 18:24:09 +0000 (+0000) Subject: Add some tests showing that upper case options don't work in MooseX::Getopt::Basic X-Git-Tag: 0.26~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d28e4285240b4d31abfe2b8b6970fa3e57c893a5;p=gitmo%2FMooseX-Getopt.git Add some tests showing that upper case options don't work in MooseX::Getopt::Basic --- diff --git a/t/105_uc_bug_more.t b/t/105_uc_bug_more.t new file mode 100644 index 0000000..061dc97 --- /dev/null +++ b/t/105_uc_bug_more.t @@ -0,0 +1,37 @@ +use strict; +use warnings; +use Test::More; +use Moose (); +use Moose::Meta::Class; + +foreach my $role (qw/ + MooseX::Getopt + MooseX::Getopt::GLD + MooseX::Getopt::Basic +/) { + Class::MOP::load_class($role); + + my $meta = Moose::Meta::Class->create_anon_class( + superclasses => ['Moose::Object'], + ); + $meta->add_attribute('Debug', traits => ['Getopt'], isa => 'Bool', + cmd_aliases => ['d'], is => 'ro'); + $role->meta->apply($meta); + + ok($meta->name->new_with_options({ argv => ['-d'] })->Debug, + "Debug was set for argv -d on $role"); + { + local @ARGV = ('-d'); + ok($meta->name->new_with_options()->Debug, + "Debug was set for ARGV on $role"); + } + + ok($meta->name->new_with_options({ argv => ['--Debug'] })->Debug, + "Debug was set for argv --Debug on $role"); + + ok($meta->name->new_with_options({ argv => ['--debug'] })->Debug, + "Debug was set for argv --debug on $role"); +} + +done_testing; +