import some (modified) MXMS tests
[p5sagit/Function-Parameters.git] / t / foreign / MooseX-Method-Signatures / eval.t
CommitLineData
595edbcf 1#!perl
2use strict;
3use warnings FATAL => 'all';
4
5use Test::More tests => 3; # last test to print
6use Function::Parameters qw(:strict);
7
8
9my $evalcode = do {
10 local $/ = undef;
11 <DATA>;
12};
13
14ok(
15 do {
16 my $r = eval $evalcode;
17 die $@ if not $r;
18 1;
19 },
20 'Basic Eval Moose'
21);
22
23my $foo = foo->new({});
24is ($foo->example (), 1, 'First method declared');
25is ($foo->example2(), 2, 'Second method declared (after injected semicolon)');
26
27__DATA__
28{
29 package foo;
30
31 use Function::Parameters qw(:strict);
32 method new($class: $init) { bless $init, $class }
33 method example { 1 } # look Ma, no semicolon!
34 method example2 { 2 }
35}
361;