Commit | Line | Data |
81b19ed8 |
1 | #!/usr/bin/env perl |
2 | |
3 | # Re RT#58715 and the claim in the documentation: |
4 | # If you have Getopt::Long::Descriptive the usage param is also passed to new. |
5 | |
6 | # This tests the fix (that fulfills the documentation claim). |
7 | |
8 | use strict; use warnings; |
9 | use Test::More tests => 3; |
10 | |
11 | { |
12 | package MyClass; |
13 | use strict; use warnings; |
14 | use Moose; |
15 | with 'MooseX::Getopt'; |
16 | } |
17 | |
18 | Moose::Meta::Class->create('MyClassWithBasic', |
19 | superclasses => ['MyClass'], |
20 | roles => [ 'MooseX::Getopt::Basic' ], |
21 | ); |
22 | |
23 | my $basic_obj = MyClassWithBasic->new_with_options(); |
24 | ok(!$basic_obj->meta->has_attribute('usage'), 'basic class has no usage attribute'); |
25 | |
26 | Moose::Meta::Class->create('MyClassWithGLD', |
27 | superclasses => ['MyClass'], |
28 | roles => [ 'MooseX::Getopt' ], |
29 | ); |
30 | |
31 | my $gld_obj = MyClassWithGLD->new_with_options(); |
32 | |
33 | ok($gld_obj->meta->has_attribute('usage'), 'class has usage attribute'); |
34 | isa_ok($gld_obj->usage, 'Getopt::Long::Descriptive::Usage'); |
35 | |