1 |
#!/usr/bin/perl -w |
2 |
|
3 |
use strict; |
4 |
|
5 |
use Test::More; |
6 |
#use blib; |
7 |
|
8 |
BEGIN { use_ok('WAIT::Database'); } |
9 |
END { system 'rm -rf test' if -d 'test'; } |
10 |
|
11 |
plan tests => 17; |
12 |
|
13 |
ok(my $db = WAIT::Database->create(name => 'test'), "create"); |
14 |
|
15 |
ok(my $tb = $db->create_table(name => 'sample', attr => ['docid', 'term']), "create_table"); |
16 |
|
17 |
ok($db->drop_table(name => 'sample'), "drop_table"); |
18 |
|
19 |
ok($tb->drop, "tb->drop"); |
20 |
|
21 |
ok($tb = $db->create_table(name => 'sample', attr => ['docid', 'term']), "create_table"); |
22 |
|
23 |
ok($tb->open, "tb->open"); |
24 |
|
25 |
ok($tb->close, "tb->close"); |
26 |
|
27 |
ok(defined $tb,"defined tb"); |
28 |
|
29 |
ok($db->close, "db->close"); |
30 |
|
31 |
ok($db = WAIT::Database->open(name => 'test'), "open"); |
32 |
|
33 |
ok($tb = $db->table(name => 'sample'), "db->table"); |
34 |
|
35 |
ok($tb->open, "tb->open"); |
36 |
|
37 |
ok($tb->set(top=>1), "tb->set(top=>1)"); |
38 |
|
39 |
ok($tb->drop, "tb->drop"); |
40 |
ok(!defined $tb, "undef tb"); |
41 |
|
42 |
# clean up |
43 |
ok($db->dispose, "dispose"); |
44 |
ok(!defined $db, "undef db"); |
45 |
|
46 |
|