X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Ffail.t;h=0e98d55c615f8fb00d471c974c487b72bae20569;hb=faaf054438bfab43b29e729879d4245ee8470729;hp=11b5830b1069e67a8c4ce17975d27fa13fc7eae8;hpb=70570efc3ad6f51bbdbd175a1a14fc6514a33997;p=p5sagit%2FDevel-Declare.git diff --git a/t/fail.t b/t/fail.t index 11b5830..0e98d55 100644 --- a/t/fail.t +++ b/t/fail.t @@ -1,15 +1,33 @@ -use Devel::Declare; +use strict; +use warnings; +use Test::More 0.88; 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/); + like($@, qr/Prototype\snot\sterminated/, 'Missing end parens'); eval 'method main ) { return "foo" }'; - like($@,qr/Illegal\sdeclaration\sof\ssubroutine/); -}; \ No newline at end of file + like($@, qr/Illegal\sdeclaration\sof\ssubroutine/, 'Missing start parens'); +}; + +TODO: { + 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'); +}; + +done_testing;