ADDED: Added test cases for "make test"

ADDED:          Added test for optional and required perl modules in
                Makefile.PL
FIXED:          NOTEDB::dumper version string were wrong, therefore
                cpan didn't index is properly.
This commit is contained in:
TLINDEN
2012-02-10 20:35:44 +01:00
parent 08cb2a0962
commit a5188ae5da
7 changed files with 97 additions and 5 deletions

53
t/run.t Normal file
View File

@@ -0,0 +1,53 @@
# -*-perl-*-
use Test::More tests => 8;
#use Test::More qw(no_plan);
BEGIN { use_ok "NOTEDB" };
require_ok("NOTEDB");
require_ok("NOTEDB::binary");
my $db = new NOTEDB::binary(dbname => "t/1.out");
ok(ref($db), "Database object loaded");
my $r = $db->set_new(1, "any new text", "23.12.2000 10:33:02");
ok($r, "true");
my $next = $db->get_nextnum();
if ($next == 2) {
pass("Get next note id");
}
else {
fail("Get next note id");
}
my ($note, $date) = $db->get_single(1);
if ($note =~ /any new text/) {
ok("Reading note");
}
else {
fail("Reading note");
}
my $expect = {
1 => {
'date' => '23.12.2000 10:33:02',
'note' => 'any new text'
}
};
my %all = $db->get_all();
is_deeply($expect, \%all, "Get all notes hash");