1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More tests => 10;
5
6do {
7    package Class;
8    use Mouse;
9
10    has pawn => (
11        is        => 'rw',
12        predicate => 'has_pawn',
13        clearer   => 'clear_pawn',
14        default   => sub { 10 },
15    );
16
17    no Mouse;
18};
19
20my $meta = Class->meta;
21isa_ok($meta, 'Mouse::Meta::Class');
22
23my $attr = $meta->get_attribute('pawn');
24isa_ok($attr, 'Mouse::Meta::Attribute');
25
26can_ok($attr, qw(name associated_class predicate clearer));
27is($attr->name, 'pawn', 'attribute name');
28is($attr->associated_class, Class->meta, 'associated_class');
29is($attr->predicate, 'has_pawn', 'predicate');
30is($attr->clearer, 'clear_pawn', 'clearer');
31ok(!$attr->is_lazy_build, "not lazy_build");
32is(ref($attr->default), 'CODE', 'default is a coderef');
33ok($attr->verify_against_type_constraint(1), 'verify_against_type_constraint works even without isa');
34