mirror of
https://codeberg.org/scip/note.git
synced 2025-12-17 04:31:02 +01:00
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:
@@ -1,3 +1,10 @@
|
|||||||
|
1.3.6:
|
||||||
|
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.
|
||||||
|
================================================================================
|
||||||
1.3.5:
|
1.3.5:
|
||||||
FIXED: Applied patch by Elmar Loos which fixes misbehavior for
|
FIXED: Applied patch by Elmar Loos which fixes misbehavior for
|
||||||
-t and -T (identical output)
|
-t and -T (identical output)
|
||||||
|
|||||||
32
Makefile.PL
32
Makefile.PL
@@ -1,7 +1,39 @@
|
|||||||
use ExtUtils::MakeMaker;
|
use ExtUtils::MakeMaker;
|
||||||
|
|
||||||
|
my %optional = (
|
||||||
|
'Crypt::CBC' => "Required by encryption support",
|
||||||
|
'Crypt::Rijndael' => "Required by encryption support",
|
||||||
|
'Data::Dumper' => "Required by dumper DB backend",
|
||||||
|
'MIME::Base64' => "Required by varios optional backends",
|
||||||
|
'Storable' => "Required by text DB backend",
|
||||||
|
'Config::General' => "Required by general DB backend",
|
||||||
|
'DB_File' => "Required by dbm DB backend",
|
||||||
|
'DBI' => "Required by mysql DB backend",
|
||||||
|
'DBD::mysql' => "Required by mysql DB backend"
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach my $module (sort keys %optional) {
|
||||||
|
eval "require $module";
|
||||||
|
if ($@) {
|
||||||
|
warn("Optional module $module no installed, $optional{$module}\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WriteMakefile(
|
WriteMakefile(
|
||||||
'NAME' => 'NOTEDB',
|
'NAME' => 'NOTEDB',
|
||||||
'VERSION_FROM' => 'NOTEDB.pm', # finds $VERSION
|
'VERSION_FROM' => 'NOTEDB.pm', # finds $VERSION
|
||||||
'EXE_FILES' => [ 'bin/note' ],
|
'EXE_FILES' => [ 'bin/note' ],
|
||||||
|
'PREREQ_PM' => {
|
||||||
|
'IO::File' => 0,
|
||||||
|
'FileHandle' => 0,
|
||||||
|
'File::Spec' => 0,
|
||||||
|
'File::Glob' => 0,
|
||||||
|
'FileHandle' => 0,
|
||||||
|
'Getopt::Long' => 0,
|
||||||
|
'Fcntl' => 0,
|
||||||
|
'IO::Seekable' => 0,
|
||||||
|
},
|
||||||
|
($ExtUtils::MakeMaker::VERSION ge '6.31'? ('LICENSE' => 'perl', ) : ()),
|
||||||
|
'clean' => { FILES => 't/*.out t/test.cfg *~ */*~' }
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ package NOTEDB::binary;
|
|||||||
$NOTEDB::binary::VERSION = "1.10";
|
$NOTEDB::binary::VERSION = "1.10";
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
#use Data::Dumper;
|
|
||||||
use IO::Seekable;
|
use IO::Seekable;
|
||||||
use File::Spec;
|
use File::Spec;
|
||||||
|
use FileHandle;
|
||||||
use Fcntl qw(LOCK_EX LOCK_UN);
|
use Fcntl qw(LOCK_EX LOCK_UN);
|
||||||
|
|
||||||
use NOTEDB;
|
use NOTEDB;
|
||||||
@@ -77,7 +77,7 @@ sub set_del_all
|
|||||||
|
|
||||||
sub get_single {
|
sub get_single {
|
||||||
my($this, $num) = @_;
|
my($this, $num) = @_;
|
||||||
my($address, $note, $date, $buffer, $n, $t, $buffer, );
|
my($address, $note, $date, $n, $t, $buffer, );
|
||||||
|
|
||||||
open NOTE, "+<$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n";
|
open NOTE, "+<$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n";
|
||||||
flock NOTE, LOCK_EX;
|
flock NOTE, LOCK_EX;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
package NOTEDB::dumper;
|
package NOTEDB::dumper;
|
||||||
|
|
||||||
$NOTEDB::text::VERSION = "1.00";
|
$NOTEDB::dumper::VERSION = "1.01";
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
|||||||
2
bin/note
2
bin/note
@@ -140,7 +140,7 @@ $CONF = File::Spec->catfile($ENV{HOME}, ".noterc");
|
|||||||
$USER = getlogin || getpwuid($<);
|
$USER = getlogin || getpwuid($<);
|
||||||
chomp $USER;
|
chomp $USER;
|
||||||
$TOPIC = 1;
|
$TOPIC = 1;
|
||||||
$version = "1.3.5";
|
$version = "1.3.6";
|
||||||
$CurDepth = 1; # the current depth inside the topic "directory" structure...
|
$CurDepth = 1; # the current depth inside the topic "directory" structure...
|
||||||
$maxlen = "auto";
|
$maxlen = "auto";
|
||||||
$timelen = 22;
|
$timelen = 22;
|
||||||
|
|||||||
2
note.pod
2
note.pod
@@ -530,6 +530,6 @@ Thomas Linden <tom at linden dot at>
|
|||||||
|
|
||||||
=head1 VERSION
|
=head1 VERSION
|
||||||
|
|
||||||
1.3.5 (07/19/2009)
|
1.3.6 (07/20/2009)
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|||||||
53
t/run.t
Normal file
53
t/run.t
Normal 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");
|
||||||
|
|
||||||
Reference in New Issue
Block a user