r1650@llin: dpavlin | 2007-11-20 11:07:57 +0100
[webpac2] / t / 5-output-webpacus.t
index 11c6a12..bc12cc5 100755 (executable)
@@ -1,30 +1,26 @@
 #!/usr/bin/perl -w
 
-use Test::More tests => 10;
-use Test::Exception;
-use Cwd qw/abs_path/;
-use Data::Dump qw/dump/;
-use blib;
 use strict;
+use blib;
+
+use Test::More tests => 11;
 
 BEGIN {
+use_ok( 'WebPAC::Test' );
 use_ok( 'WebPAC::Output::Webpacus' );
 }
 
-my $debug = shift @ARGV;
-
-ok(my $abs_path = abs_path($0), "abs_path");
-$abs_path =~ s#/[^/]*$#/#; #
-diag "abs_path: $abs_path";
-my $path = "$abs_path/sorted/";
-
 ok(my $out = new WebPAC::Output::Webpacus({
        path => '/data/Webpacus2/',
        database => 'test',
        clean => 1,
-       debug => $debug,
+       %LOG
 }), "new");
 
+ok( $out->consume_outputs, 'consume_outputs' );
+
+diag "consume_outputs = ",dump( $out->consume_outputs ) if $debug;
+
 ok( $out->init, 'init' );
 
 my $ds = {
@@ -49,7 +45,7 @@ ok( $out->add( 99, { foo => { sorted => 'bar' } } ), 'add 99' );
 
 ok( $out->add( 100, { foo => { sorted => [ qw/foo bar baz/ ] } } ), 'add 100' );
 
-diag "path: ",$out->path;
+diag "path: ",$out->path if $debug;
 
-ok( $out->finish, 'finish' );
+cmp_ok( $out->finish, '==', 4, 'finish' );