X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Ffail.t;h=bb519789f94bf2fbadf400f0610ec7a7a7059b1a;hb=9bbd73fb5569e01b90f48513765712a63d34ea1b;hp=3e8cc4a96a37fd3ce32325d9aa866f45c024778d;hpb=390ce4e811404cc9a8ec4dc55e62eff960350ce7;p=p5sagit%2FDevel-Declare.git diff --git a/t/fail.t b/t/fail.t index 3e8cc4a..bb51978 100644 --- a/t/fail.t +++ b/t/fail.t @@ -1,22 +1,33 @@ -use Devel::Declare; +use strict; +use warnings; +use Test::More; use Devel::Declare::MethodInstaller::Simple; -BEGIN { Devel::Declare::MethodInstaller::Simple->install_methodhandler(name => 'method', into => 'main') }; - -use Test::More 'no_plan'; +BEGIN { + Devel::Declare::MethodInstaller::Simple->install_methodhandler( + name => 'method', + into => __PACKAGE__, + ); +} TODO: { - local $TODO='Method does not throw proper errors for bad parens yet'; + local $TODO = 'Method does not throw proper errors for bad parens yet'; + eval 'method main ( { return "foo" }'; - like($@,qr/Prototype\snot\sterminated/,'Missing end parens'); + like($@, qr/Prototype\snot\sterminated/, 'Missing end parens'); eval 'method main ) { return "foo" }'; - like($@,qr/Illegal\sdeclaration\sof\ssubroutine/,'Missing start parens'); + like($@, qr/Illegal\sdeclaration\sof\ssubroutine/, 'Missing start parens'); }; TODO: { - local $TODO='method does not throw proper errors for bad parens yet'; - eval 'method 1main() { return "foo" }','Sub starting with a number'; - like($@,qr/Illegal\sdeclaration\sof\sanonymous\ssubroutine/); + local $TODO = 'method does not disallow invalid sub names'; + + eval 'method 1main() { return "foo" }'; + like($@, qr/Illegal\sdeclaration\sof\sanonymous\ssubroutine/, 'starting with a number'); + + eval 'method møø() { return "foo" }'; + like($@, qr/Illegal\sdeclaration\sof\ssubroutine\smain\:\:m/, 'with unicode'); +}; -}; \ No newline at end of file +done_testing;