misc junk
[gitmo/Moose.git] / t / 019_method_keyword.t
CommitLineData
3279ab4a 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More no_plan => 1;
7
8BEGIN {
9 use_ok('Moose');
10}
11
12{
13 package Foo;
14 use Moose;
15
16 sub greetings {
17 "Hello, $_[1]";
18 }
19
20 method 'greet_world_from' => sub {
21 my $from = shift;
22 self->greetings("World") . " from $from";
23 };
24
25 method 'greet_world_from_me' => sub {
26 self->greet_world_from("Stevan");
27 };
28
29 no Moose;
30}
31
32my $foo = Foo->new;
33isa_ok($foo, 'Foo');
34
35is($foo->greetings('World'), 'Hello, World', '... got the right value from greetings');
36is($foo->greet_world_from('Stevan'), 'Hello, World from Stevan', '... got the right value from greet_world_from');
37is($foo->greet_world_from_me, 'Hello, World from Stevan', '... got the right value from greet_world');