Annotation of palm/Palm-Keyring/t/keyring.t, Revision 1.1
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 lib '../lib';
! 12: use Palm::Keyring;
! 13: $loaded = 1;
! 14: print "ok 1\n";
! 15:
! 16:
! 17: ######################### End of black magic.
! 18:
! 19: # Insert your test code below (better if it prints "ok 13"
! 20: # (correspondingly "not ok 13") depending on the success of chunk 13
! 21: # of the test code):
! 22:
! 23: my $password = '12345';
! 24: my $pdb;
! 25:
! 26: eval { $pdb = new Palm::Keyring($password) };
! 27: unless( $@ ) {
! 28: print "ok 2\n";
! 29: } else {
! 30: print "not ok 2\n";
! 31: }
! 32:
! 33: my $record;
! 34:
! 35: eval { $record = $pdb->append_Record() };
! 36: unless( $@ ) {
! 37: print "ok 3\n";
! 38: } else {
! 39: print "not ok 3\n";
! 40: }
! 41:
! 42: $record->{plaintext} = {
! 43: name => 'Test3',
! 44: account => 'atestaccount',
! 45: password => $password,
! 46: description => 'now that really roxorZ!',
! 47: };
! 48:
! 49: my $file = 'Keys-GTKR-test.pdb';
! 50:
! 51: if ( $pdb->Write($file) ) {
! 52: print "ok 4\n";
! 53: } else {
! 54: print "not ok 4\n";
! 55: }
! 56:
! 57: if ( $pdb->Load($file, $password) ) {
! 58: print "ok 5\n";
! 59: } else {
! 60: print "not ok 5\n";
! 61: }
! 62:
! 63: if ($pdb->{'records'}->[1]->{'plaintext'}->{'password'} eq $password) {
! 64: print "ok 6\n";
! 65: } else {
! 66: print "not ok 6\n";
! 67: }
! 68:
! 69: unlink($file);
! 70:
! 71: 1;
! 72:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>