/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use Test::More tests => 11;
6 use Test::Exception;
7 use File::Temp qw/ :mktemp /;
8 use blib;
9
10 BEGIN { use_ok('SWISH::Split') };
11
12 # FIXME debug
13 system "rm -Rf /tmp/swish?????";
14
15 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 throws_ok { SWISH::Split->open(%param) } qr/slices/, "need slices";
28
29 $param{'slices'} = 3;
30 throws_ok { SWISH::Split->open(%param) } qr/index/, "need index";
31
32 ok($param{'index'} = mktemp("/tmp/swishXXXXX"), "make temp name");
33
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
45 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