Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 62 lines (44 sloc) 1.099 kB
b33679b @pjcj Fix similar problem with branch coverage.
authored
1 #!/usr/bin/perl
2
3 # Copyright 2012, Paul Johnson (paul@pjcj.net)
4
5 # This software is free. It is licensed under the same terms as Perl itself.
6
7 # The latest version of this software should be available from my homepage:
8 # http://www.pjcj.net
9
10 # __COVER__ skip_test $] < 5.008005 || !(eval "use DBM::Deep; 23")
11 # __COVER__ skip_reason DBM::Deep not available
12
13 use strict;
14 use warnings;
15
16 use Test::More;
17
18 use DBM::Deep;
19
20 my $db = DBM::Deep->new( "temp.db" );
21 $db->{1} = 1;
22
23 my $h = { 1 => 1 };
24
25 sub testdbm
26 {
27 my ( $p ) = @_;
28
29 if( exists $db->{$p} )
30 {
31 return "dbm: exists";
32 }
33 else
34 {
35 return "dbm: does not exist";
36 }
37 }
38
39 sub testh
40 {
41 my ( $p ) = @_;
42
43 if( exists $h->{$p} )
44 {
45 return "h: exists";
46 }
47 else
48 {
49 return "h: does not exist";
50 }
51 }
52
53 is( testdbm( 1 ), "dbm: exists", "key exists in dbm" );
54 is( testdbm( 2 ), "dbm: does not exist", "key does not exist in dbm" );
55
56 is( testh( 1 ), "h: exists", "key exists in h" );
57 is( testh( 2 ), "h: does not exist", "key does not exist in h" );
58
59 unlink "temp.db";
60
61 done_testing();
Something went wrong with that request. Please try again.