2 # This file is part of Class::Modular and is released under the terms
3 # of the GPL version 2, or any later version at your option. See the
4 # file README and COPYING for more information.
5 # Copyright 2004 by Don Armstrong <don@donarmstrong.com>.
9 use Test::More tests => 11;
13 use_ok('Class::Modular');
22 use vars qw(@METHODS);
27 use base qw(Class::Modular);
43 use base qw(Class::Modular);
57 my $foo = new Foo(qw(bar baz));
60 ok(defined $foo and UNIVERSAL::isa($foo,'Class::Modular'), 'new() works');
63 ok($foo->is_loaded('Foo'), 'load and is_loaded work');
65 ok($foo->blah, 'AUTOLOAD works');
68 $foo->override('blah',sub{return 2});
69 ok($foo->blah == 2, 'override() works');
73 ok($foo->can('blah'),'can() works');
76 ok(defined $foo->clone, 'clone() works');
79 ok($foo->handledby('blah') eq 'Foo', 'handledby() works');
83 ok($destroy_hit,'DESTROY called _destroy');
85 # Check non-existant _destroy doesn't cause a failure
87 eval {my $bar = new Bar();
90 ok($@ eq '','Non existant _destroy not a problem');
92 # Check _methods way of defining methods
94 ok($bar->bleh, '_methods function works to define methods');