/[SWISH-Split]/trunk/t/SWISH-Split.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/t/SWISH-Split.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Sun Aug 8 10:27:27 2004 UTC (19 years, 7 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1035 byte(s)
better tests

1 dpavlin 1 #!/usr/bin/perl -w
2    
3     use strict;
4    
5 dpavlin 2 use Test::More tests => 11;
6 dpavlin 1 use Test::Exception;
7     use File::Temp qw/ :mktemp /;
8     use blib;
9    
10     BEGIN { use_ok('SWISH::Split') };
11    
12 dpavlin 2 # FIXME debug
13     system "rm -Rf /tmp/swish?????";
14    
15 dpavlin 1 my %param;
16    
17     throws_ok { SWISH::Split->open(%param) } qr/slice_name/, "slice_name";
18    
19     sub slice_1st_char {
20     return substr($_[0],0,1);
21     };
22    
23     use Data::Dumper;
24     print Dumper(\&slice_1st_char);
25    
26     $param{'slice_name'} = \&slice_1st_char;
27 dpavlin 2 throws_ok { SWISH::Split->open(%param) } qr/slices/, "need slices";
28 dpavlin 1
29     $param{'slices'} = 3;
30 dpavlin 2 throws_ok { SWISH::Split->open(%param) } qr/index/, "need index";
31 dpavlin 1
32 dpavlin 2 ok($param{'index'} = mktemp("/tmp/swishXXXXX"), "make temp name");
33 dpavlin 1
34 dpavlin 2 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    
45 dpavlin 1 ok(my $i=SWISH::Split->open(%param), "open");
46    
47     # methods test
48    
49    
50    
51     # internal functions test
52    
53     cmp_ok($i->in_slice("swishpath"), '==', 2, "open");
54    

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26