r1604@llin: dpavlin | 2007-11-11 21:02:22 +0100
[webpac2] / t / 1-validate.t
index 8b62d47..8fedbd9 100755 (executable)
@@ -1,31 +1,22 @@
 #!/usr/bin/perl -w
 
 use strict;
-use Test::More tests => 54;
-use Test::Exception;
 use blib;
 
-use Data::Dump qw/dump/;
-use Cwd qw/abs_path/;
+use Test::More tests => 54;
 
 BEGIN {
+use_ok( 'WebPAC::Test' );
 use_ok( 'WebPAC::Validate' );
 }
 
-my $debug = shift @ARGV;
-
-ok(my $abs_path = abs_path($0), "abs_path");
-$abs_path =~ s#/[^/]*$#/#;
-
-ok(my $v = new WebPAC::Validate(
-       debug => $debug,
-), "new witout path");
+ok(my $v = new WebPAC::Validate(%LOG), "new witout path");
 
 ok( ! $v->{rules}, 'no path' );
 
-ok(my $v = new WebPAC::Validate(
+ok($v = new WebPAC::Validate(
        path => "$abs_path/data/validate_test",
-       debug => $debug,
+       %LOG,
 ), "new with path");
 
 ok($v->{rules}, "rules exist");
@@ -89,7 +80,7 @@ sub test_v {
                        if (ref($tmp) eq 'HASH') {
                                return $tmp;
                        } else {
-                               diag "explanation: $tmp";
+                               diag "explanation: $tmp" if $debug;
                        }
                }
        } else {