1 # This file is part of Class::Modular and is released under the terms
2 # of the GPL version 2, or any later version at your option. See the
3 # file README and COPYING for more information.
4 # Copyright 2004 by Don Armstrong <don@donarmstrong.com>.
8 use Test::Simple tests => 9;
19 use base qw(Class::Modular);
20 use constant METHODS => 'blah';
40 use base qw(Class::Modular);
41 use constant METHODS => 'bleh';
55 my $foo = new Foo(qw(bar baz));
58 ok(defined $foo and UNIVERSAL::isa($foo,'Class::Modular'), 'new() works');
61 ok(exists $foo->{__class_modular}{_subclasses}{Foo}, 'load() works');
63 ok($foo->blah, 'AUTOLOAD works');
66 $foo->override('blah',sub{return 2});
67 ok($foo->blah == 2, 'override() works');
71 ok($foo->can('blah'),'can() works');
74 ok(defined $foo->clone, 'clone() works');
77 ok($foo->handledby('blah') eq 'Foo', 'handledby() works');
81 ok($destroy_hit,'DESTROY called _destroy');
83 # Check non-existant _destroy doesn't cause a failure
85 eval {my $bar = new Bar();
88 ok($@ eq '','Non existant _destroy not a problem');