add strict and warnings
[p5sagit/Devel-Declare.git] / t / method-installer-runtime.t
index c16ea5d..62926b4 100644 (file)
@@ -1,14 +1,8 @@
-
 use strict;
-
-use Test::More tests => 3;
-
-use lib 'lib';
+use warnings;
+use Test::More tests => 2;
 use Devel::Declare::MethodInstaller::Simple;
 
-# suppress warnings
-sub Devel::Declare::MethodInstaller::Simple::parse_proto { '' }
-
 BEGIN {
   Devel::Declare::MethodInstaller::Simple->install_methodhandler(
     name => 'method',
@@ -16,10 +10,11 @@ BEGIN {
   );
 }
 
-is eval { foo() } , undef;
-like $@, qr/subroutine &main::foo/;
+ok(!main->can('foo'), 'foo() not installed yet');
 
-method foo { 1 }
+method foo {
+    $_[0]->method
+}
 
-is foo(), 1;
+ok(main->can('foo'), 'foo() installed at runtime');