Annotation of palm/Palm-Keyring/t/keyring.t, Revision 1.2
1.1 andrew 1: # Before `make install' is performed this script should be runnable with
2: # `make test'. After `make install' it should work as `perl test.pl'
3:
4: ######################### We start with some black magic to print on failure.
5:
6: # Change 1..1 below to 1..last_test_to_print .
7: # (It may become useful if the test is moved to ./t subdirectory.)
8:
9: BEGIN { $| = 1; print "1..6\n"; }
10: END {print "not ok 1\n" unless $loaded;}
11: use Palm::Keyring;
12: $loaded = 1;
13: print "ok 1\n";
14:
15:
16: ######################### End of black magic.
17:
18: # Insert your test code below (better if it prints "ok 13"
19: # (correspondingly "not ok 13") depending on the success of chunk 13
20: # of the test code):
21:
22: my $password = '12345';
23: my $pdb;
24:
25: eval { $pdb = new Palm::Keyring($password) };
26: unless( $@ ) {
27: print "ok 2\n";
28: } else {
29: print "not ok 2\n";
30: }
31:
32: my $record;
33:
34: eval { $record = $pdb->append_Record() };
35: unless( $@ ) {
36: print "ok 3\n";
37: } else {
38: print "not ok 3\n";
39: }
40:
41: $record->{plaintext} = {
42: name => 'Test3',
43: account => 'atestaccount',
44: password => $password,
45: description => 'now that really roxorZ!',
46: };
47:
48: my $file = 'Keys-GTKR-test.pdb';
49:
50: if ( $pdb->Write($file) ) {
51: print "ok 4\n";
52: } else {
53: print "not ok 4\n";
54: }
55:
56: if ( $pdb->Load($file, $password) ) {
57: print "ok 5\n";
58: } else {
59: print "not ok 5\n";
60: }
61:
62: if ($pdb->{'records'}->[1]->{'plaintext'}->{'password'} eq $password) {
63: print "ok 6\n";
64: } else {
65: print "not ok 6\n";
66: }
67:
68: unlink($file);
69:
70: 1;
71:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>