-#!/usr/bin/perl
-
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More;
-BEGIN {
- use_ok('Class::MOP');
-}
+use Class::MOP;
=pod
{
package Foo;
use metaclass;
-
+
Foo->meta->add_attribute('foo' => (
init_arg => 'foo',
reader => 'get_foo',
default => 'BAR',
));
-
+
}
my $foo = Foo->meta->new_object;
my $clone = $foo->meta->clone_object($foo, foo => 'BAZ');
isa_ok($clone, 'Foo');
isnt($clone, $foo, '... and it is a clone');
-
+
is($clone->get_foo, 'BAZ', '... got the right cloned value');
}
my $clone = $foo->meta->clone_object($foo, foo => undef);
isa_ok($clone, 'Foo');
isnt($clone, $foo, '... and it is a clone');
-
+
ok(!defined($clone->get_foo), '... got the right cloned value');
}
-
-
-
-
-
+done_testing;