File: fail.t

package info (click to toggle)
libdevel-declare-perl 0.006000-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 296 kB
  • ctags: 238
  • sloc: perl: 1,605; ansic: 756; makefile: 25
file content (31 lines) | stat: -rw-r--r-- 904 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use warnings;
use Test::More 'no_plan';

use Devel::Declare::MethodInstaller::Simple;
BEGIN {
    Devel::Declare::MethodInstaller::Simple->install_methodhandler(
        name => 'method',
        into => __PACKAGE__,
    );
}

TODO: {
    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');

    eval 'method main ) { return "foo" }';
    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');
};