Check failure for subs starting with numbers
[p5sagit/Devel-Declare.git] / t / fail.t
1 use Devel::Declare;
2
3 use Devel::Declare::MethodInstaller::Simple;
4 BEGIN { Devel::Declare::MethodInstaller::Simple->install_methodhandler(name => 'method', into => 'main') };
5
6 use Test::More 'no_plan';
7
8 TODO: {
9     local $TODO='Method does not throw proper errors for bad parens yet';
10     eval 'method main ( { return "foo" }';
11     like($@,qr/Prototype\snot\sterminated/,'Missing end parens'); 
12
13     eval 'method main ) { return "foo" }';
14     like($@,qr/Illegal\sdeclaration\sof\ssubroutine/,'Missing start parens');
15 };
16
17 TODO: {
18     local $TODO='method does not throw proper errors for bad parens yet';
19     eval 'method 1main() { return "foo" }','Sub starting with a number';
20     like($@,qr/Illegal\sdeclaration\sof\sanonymous\ssubroutine/); 
21
22 };