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