From: Shawn M Moore Date: Sat, 19 Feb 2011 03:16:12 +0000 (-0500) Subject: Use $0 instead of hardcoding filename in regex X-Git-Tag: 1.9904~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e46b3371728006699cc62b16b519a1b165465b6e;p=gitmo%2FMoose.git Use $0 instead of hardcoding filename in regex I failed these tests because zsh prove t/**/*.t expanded these files with leading ./s, which broke the regexes needlessly --- diff --git a/t/010_basics/022_buildargs_warning.t b/t/010_basics/022_buildargs_warning.t index 978800a..31e8b04 100644 --- a/t/010_basics/022_buildargs_warning.t +++ b/t/010_basics/022_buildargs_warning.t @@ -19,7 +19,7 @@ use Test::Requires { with_immutable { is( exception { stderr_like { Baz->new( x => 42, 'y' ) } - qr{\QThe new() method for Baz expects a hash reference or a key/value list. You passed an odd number of arguments at t/010_basics/022_buildargs_warning.t line \E\d+}, + qr{\QThe new() method for Baz expects a hash reference or a key/value list. You passed an odd number of arguments at $0 line \E\d+}, 'warning when passing an odd number of args to new()'; stderr_unlike { Baz->new( x => 42, 'y' ) } diff --git a/t/010_basics/030_deprecations.t b/t/010_basics/030_deprecations.t index 90880c6..cb2eaf9 100644 --- a/t/010_basics/030_deprecations.t +++ b/t/010_basics/030_deprecations.t @@ -32,7 +32,7 @@ use Test::Requires { isa => 'Str', ); } - qr{\QAllowing a native trait to automatically supply a default is deprecated. You can avoid this warning by supplying a default, builder, or making the attribute required at t/010_basics/030_deprecations.t line}, + qr{\QAllowing a native trait to automatically supply a default is deprecated. You can avoid this warning by supplying a default, builder, or making the attribute required at $0 line}, 'Not providing a default for native String trait warns'; ::stderr_is{ has bar => ( @@ -43,7 +43,7 @@ use Test::Requires { } q{}, 'No warning when _default_is is set'; ::stderr_like{ Foo->new->bar } - 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}, + 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 $0 line}, 'calling a reader on a method created by a _default_is warns'; ::stderr_like{ with 'Role' =>