~ubuntu-branches/ubuntu/precise/libmoosex-aliases-perl/precise

« back to all changes in this revision

Viewing changes to t/005-mop.t

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Yu
  • Date: 2011-02-26 22:55:41 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110226225541-eiamo6l2vqqdbdtu
Tags: 0.09-1
* New upstream release
* Bump to debhelper compat 8
* Use new 3.0 (quilt) source format
* Standards-Version 3.9.1
  - Explicitly refer to GPL-1 license text in common-licenses.
* Update dependencies per upstream
* No longer run RELEASE_TESTING tests
* Refresh copyright information

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env perl
2
 
use strict;
3
 
use warnings;
4
 
use Test::More tests => 8;
5
 
 
6
 
{
7
 
    package MyTest;
8
 
    use Moose;
9
 
    use MooseX::Aliases;
10
 
 
11
 
    sub foo { }
12
 
    alias bar => 'foo';
13
 
 
14
 
    has baz => (
15
 
        is    => 'ro',
16
 
        alias => 'quux',
17
 
    );
18
 
}
19
 
 
20
 
{
21
 
    my $method = MyTest->meta->get_method('bar');
22
 
    ok($method->meta->does_role('MooseX::Aliases::Meta::Trait::Method'),
23
 
       'does the method trait');
24
 
    is($method->aliased_from, 'foo', 'bar is aliased from foo');
25
 
    my $attr_method = MyTest->meta->get_method('quux');
26
 
    ok($attr_method->meta->does_role('MooseX::Aliases::Meta::Trait::Method'),
27
 
       'does the method trait');
28
 
    is($attr_method->aliased_from, 'baz', 'quux is aliased from baz');
29
 
 
30
 
    if (MyTest->meta->is_mutable) {
31
 
        MyTest->meta->make_immutable;
32
 
        redo;
33
 
    }
34
 
}