8 'Test::Output' => '0.01',
11 # All tests are wrapped with lives_and because the stderr output tests will
12 # otherwise eat exceptions, and the test just dies silently.
29 ::stderr_like{ has foo => (
35 qr{\QAllowing a native trait to automatically supply a default is deprecated. You can avoid this warning by supply a default, builder, or making the attribute required at t/010_basics/030_deprecations.t line},
36 'Not providing a default for native String trait warns';
38 ::stderr_is{ has bar => (
43 } q{}, 'No warning when _default_is is set';
45 ::stderr_like{ Foo->new->bar }
46 qr{\QThe bar method in the Foo class was automatically created by the native delegation trait for the bar attribute. This "default is" feature is deprecated. Explicitly set "is" or define accessor names to avoid this at t/010_basics/030_deprecations.t line},
47 'calling a reader on a method created by a _default_is warns';
49 ::stderr_like{ with 'Role' =>
50 { excludes => ['thing'], alias => { thing => 'thing2' } };
52 qr/\QThe alias and excludes options for role application have been renamed -alias and -excludes (applying Role to Foo - do you need to upgrade Foo?)/,
53 'passing excludes or alias with a leading dash warns';
55 !Foo->meta->has_method('thing'),
56 'thing method is excluded from role application'
59 Foo->meta->has_method('thing2'),
60 'thing2 method is created as alias in role application'
72 ::stderr_is{ has foo => (
76 builder => '_build_foo',
79 'Providing a builder for a String trait avoids default default warning';
90 'no default is assigned when reader is provided'
93 ::stderr_is{ Pack1->new->_bar } q{},
94 'Providing a reader for a String trait avoids default is warning';
98 sub _build_foo { q{} }
108 ::stderr_is{ has foo => (
109 traits => ['String'],
115 'Making a String trait required avoids default default warning';
118 traits => ['String'],
126 'no default is assigned when writer is provided'
129 ::stderr_is{ Pack2->new( foo => 'x' )->_bar('x') }
131 'Providing a writer for a String trait avoids default is warning';
142 ::stderr_is{ has foo => (
143 traits => ['String'],
149 'Making a String trait lazy_build avoids default default warning';
152 traits => ['String'],
160 'no default is assigned when accessor is provided'
163 ::stderr_is{ Pack3->new->_bar }
165 'Providing a accessor for a String trait avoids default is warning';
169 sub _build_foo { q{} }