got rid of all the use_ok junk except for 000_load.t
[gitmo/Class-MOP.git] / t / 301_RT_27329_fix.t
CommitLineData
795a0c8b 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
efd3d14c 6use Test::More tests => 8;
795a0c8b 7
efd3d14c 8use Class::MOP;
795a0c8b 9
10=pod
11
12This tests a bug sent via RT #27329
13
14=cut
15
16{
17 package Foo;
18 use metaclass;
19
20 Foo->meta->add_attribute('foo' => (
21 init_arg => 'foo',
22 reader => 'get_foo',
23 default => 'BAR',
24 ));
25
26}
27
28my $foo = Foo->meta->new_object;
29isa_ok($foo, 'Foo');
30
31is($foo->get_foo, 'BAR', '... got the right default value');
32
33{
34 my $clone = $foo->meta->clone_object($foo, foo => 'BAZ');
35 isa_ok($clone, 'Foo');
36 isnt($clone, $foo, '... and it is a clone');
37
38 is($clone->get_foo, 'BAZ', '... got the right cloned value');
39}
40
41{
42 my $clone = $foo->meta->clone_object($foo, foo => undef);
43 isa_ok($clone, 'Foo');
44 isnt($clone, $foo, '... and it is a clone');
45
46 ok(!defined($clone->get_foo), '... got the right cloned value');
47}
48
49
50
51
52
53