test excell file
[webpac2] / t / 5-output-sorted.t
index b43c9be..d9b2b61 100755 (executable)
@@ -1,28 +1,22 @@
 #!/usr/bin/perl -w
 
-use Test::More tests => 13;
-use Test::Exception;
-use Cwd qw/abs_path/;
-use Data::Dump qw/dump/;
-use blib;
 use strict;
+use blib;
+
+use Test::More tests => 16;
 
 BEGIN {
+use_ok( 'WebPAC::Test' );
 use_ok( 'WebPAC::Output::Sorted' );
 }
 
-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::Sorted({
        path => $path,
        database => 'test',
        clean => 1,
-       debug => $debug,
+       %LOG
 }), "new");
 
 ok( $out->init, 'init' );
@@ -51,9 +45,11 @@ ok( $out->add( 100, { foo => { sorted => [ qw/foo bar baz/ ] } } ), 'add 100' );
 
 ok( -e $out->path, "created $path" );
 
-diag $out->path," eq ",$path;
+diag $out->path," eq ",$path if $debug;
 cmp_ok( $out->path, 'eq', $path, 'path' );
 
 ok( $out->finish, 'finish' );
 
-ok( -e "$path/test.txt", 'list' );
+foreach my $l ( qw/source id array foo/ ) {
+       ok( -e "$path/$l.txt", "list $l exists" );
+}