6 use Test::More tests => 7;
13 my $anon_class = Class::MOP::Class->create_anon_class();
14 isa_ok($anon_class, 'Class::MOP::Class');
16 like($anon_class->name, qr/Class::MOP::Class::__ANON__::SERIAL::[0-9]+/, '... got an anon class package name');
19 $anon_class->add_method('foo' => sub { "__ANON__::foo" });
20 } '... added a method to my anon-class';
22 my $instance = $anon_class->new_object();
23 isa_ok($instance, $anon_class->name);
25 is($instance->foo, '__ANON__::foo', '... got the right return value of our foo method');
28 # I bumped this test up to 100_000 instances, and
29 # still got not conflicts. If your application needs
30 # more than that, your probably mst
33 foreach my $i (1 .. 1000) {
34 $conflicts{ Class::MOP::Class->create_anon_class()->name } = undef;
36 is(scalar(keys %conflicts), 1000, '... got as many classes as I would expect');