#!/usr/bin/perl -w
BEGIN {
$| = 1;
unless
(
$ENV
{HARNESS_ACTIVE} ) {
chdir
(
$FindBin::Bin
=
$FindBin::Bin
);
lib->
import
( catdir( updir(), updir(),
'modules'
) );
}
}
is( Foo->foo, 1,
'->foo returns as expected'
);
is( Foo->bar, 1,
'A single alias works as expected'
);
is( Foo->baz, 1,
'A duplicate alias works as expected'
);
is( Foo->blah, 1,
'Double alias works as expected'
);
'baz'
=>
'foo'
,
'blah'
=>
'bar'
;
sub
foo { 1 }
ok( Method::Alias->
import
(
'this'
,
'foo'
),
'Direct call to import returns true'
);
is( Foo->this, 1,
'Resulting alias is created'
);
sub
foo { 2 }
is( Foo->foo, 1,
'->foo from original returns as expected'
);
is( Foo::Bar->foo, 2,
'->from from subclass returns as expected'
);
is( Foo::Bar->bar, 2,
'->bar from subclass returns as expected'
);
is( Foo::Bar->blah, 2,
'Double from subclass returns as expected'
);
1;