Revision 2

Date:
2004/08/08 10:27:27
Author:
dpavlin
Revision Log:
better tests
Files:

Legend:

 
Added
 
Removed
 
Modified
  • trunk/t/SWISH-Split.t

     
    2 2
    3 3 use strict;
    4 4
    5 use Test::More tests => 9;
    5 use Test::More tests => 11;
    6 6 use Test::Exception;
    7 7 use File::Temp qw/ :mktemp /;
    8 8 use blib;
    9 9
    10 10 BEGIN { use_ok('SWISH::Split') };
    11 11
    12 # FIXME debug
    13 system "rm -Rf /tmp/swish?????";
    14
    12 15 my %param;
    13 16
    14 17 throws_ok { SWISH::Split->open(%param) } qr/slice_name/, "slice_name";
     
    21 24 print Dumper(\&slice_1st_char);
    22 25
    23 26 $param{'slice_name'} = \&slice_1st_char;
    24 throws_ok { SWISH::Split->open(%param) } qr/slices/, "slices";
    27 throws_ok { SWISH::Split->open(%param) } qr/slices/, "need slices";
    25 28
    26 29 $param{'slices'} = 3;
    27 throws_ok { SWISH::Split->open(%param) } qr/index/, "index";
    30 throws_ok { SWISH::Split->open(%param) } qr/index/, "need index";
    28 31
    29 ok($param{'index'} = mkstemp("/tmp/swishXXXXX"), "make temp index");
    30 throws_ok { SWISH::Split->open(%param) } qr/dir/, "dir";
    32 ok($param{'index'} = mktemp("/tmp/swishXXXXX"), "make temp name");
    31 33
    32 ok($param{'index'} = mkdtemp("/tmp/swishXXXXX"), "make temp index");
    34 diag "index path: $param{'index'}\n";
    35
    36 ok(open(F, "> $param{'index'}"), "touch");
    37 close(F);
    38
    39 throws_ok { SWISH::Split->open(%param) } qr/dir/, "need dir";
    40
    41 ok(unlink($param{'index'}), "rm");
    42
    43 ok(mkdir($param{'index'}), "mkdir");
    44
    33 45 ok(my $i=SWISH::Split->open(%param), "open");
    34 46
    35 47 # methods test