File: loadwrite.t

package info (click to toggle)
libpalm-pdb-perl 1.400-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 256 kB
  • sloc: perl: 1,406; makefile: 7
file content (36 lines) | stat: -rwxr-xr-x 647 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use strict;
use Test::More qw(no_plan);

BEGIN { use_ok('Palm::PDB') }
BEGIN { use_ok('Palm::Raw') }
BEGIN { use_ok('IO::File') }

my $name = "t/Test.pdb";

my $pdb = Palm::Raw->new;
ok( defined $pdb );
$pdb->{name} = "Test";
for( qw(tic tac toe) ) {
	print "storing '$_'\n";
	my $rec = $pdb->append_Record();
	ok( defined $rec );
	$rec->{data} = $_;
}
$pdb->Write( $name );
pass( "Write" );
undef $pdb;

my $fh = new IO::File $name, "r+";
ok( defined $fh );

$pdb = Palm::PDB->new;
ok( defined $pdb );
$pdb->Load( $fh );
pass( "Load" );

for( @{$pdb->{records}} ) {
	print "got '$_->{data}'\n";
	ok( defined $_ and length $_->{data} > 0 );
}

1;