]> git.donarmstrong.com Git - class_modular.git/.git/blobdiff - t/01_module.t
* We now follow the subclasses @METHOD and @SUB_MODULE arrays if they
[class_modular.git/.git] / t / 01_module.t
index 17ce5ec528bde92b0130fe50d8a4e16f75bdf3d8..3f2f33d36f53302961caad53c5e1c464fae9e949 100644 (file)
@@ -1,3 +1,4 @@
+# -*- mode: cperl;-*-
 # This file is part of Class::Modular and is released under the terms
 # of the GPL version 2, or any later version at your option. See the
 # file README and COPYING for more information.
@@ -5,10 +6,12 @@
 # $Id: $
 
 
-use Test::Simple tests => 9;
+use Test::More tests => 11;
 
 use UNIVERSAL;
 
+use_ok('Class::Modular');
+
 my $destroy_hit = 0;
 
 {
@@ -16,17 +19,17 @@ my $destroy_hit = 0;
      $INC{'Foo.pm'} = '1';
      package Foo;
 
+     use vars qw(@METHODS);
+     BEGIN {
+         @METHODS = qw(blah);
+     }
+
      use base qw(Class::Modular);
-     use constant METHODS => 'blah';
 
      sub blah {
          return 1;
      }
 
-     sub _methods {
-          return qw(blah);
-     }
-
      sub _destroy{
          $destroy_hit = 1;
      }
@@ -38,7 +41,6 @@ my $destroy_hit = 0;
      package Bar;
 
      use base qw(Class::Modular);
-     use constant METHODS => 'bleh';
 
      sub bleh {
          return 1;
@@ -58,7 +60,7 @@ my $foo = new Foo(qw(bar baz));
 ok(defined $foo and UNIVERSAL::isa($foo,'Class::Modular'), 'new() works');
 
 # 2: test load()
-ok(exists $foo->{__class_modular}{_subclasses}{Foo}, 'load() works');
+ok($foo->is_loaded('Foo'), 'load and is_loaded work');
 # 3: test AUTOLOAD
 ok($foo->blah, 'AUTOLOAD works');
 
@@ -86,3 +88,7 @@ eval {my $bar = new Bar();
       undef $bar;
  };
 ok($@ eq '','Non existant _destroy not a problem');
+
+# Check _methods way of defining methods
+my $bar = new Bar;
+ok($bar->bleh, '_methods function works to define methods');