make all warnings fatal in tests
[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
aec09248 6use strict; use warnings FATAL => 'all';
9fbb5be9 7use Test::More tests => 4;
8use Test::NoWarnings 1.04 ':early';
81b19ed8 9
10{
11 package MyClass;
aec09248 12 use strict; use warnings FATAL => 'all';
81b19ed8 13 use Moose;
14 with 'MooseX::Getopt';
15}
16
17Moose::Meta::Class->create('MyClassWithBasic',
18 superclasses => ['MyClass'],
19 roles => [ 'MooseX::Getopt::Basic' ],
20);
21
22my $basic_obj = MyClassWithBasic->new_with_options();
23ok(!$basic_obj->meta->has_attribute('usage'), 'basic class has no usage attribute');
24
25Moose::Meta::Class->create('MyClassWithGLD',
26 superclasses => ['MyClass'],
27 roles => [ 'MooseX::Getopt' ],
28);
29
30my $gld_obj = MyClassWithGLD->new_with_options();
31
32ok($gld_obj->meta->has_attribute('usage'), 'class has usage attribute');
33isa_ok($gld_obj->usage, 'Getopt::Long::Descriptive::Usage');
34