3 use Test::More qw(no_plan);
5 use constant ERROR_REGEXP => qr{Can't dbmopen\(%hash, 'foo/bar/baz', 0666\):};
7 my $return = "default";
10 $return = dbmopen(my %foo, "foo/bar/baz", 0666);
13 ok(!$return, "Sanity: dbmopen usually returns false on failure");
14 ok(!$@, "Sanity: dbmopen doesn't usually throw exceptions");
19 dbmopen(my %foo, "foo/bar/baz", 0666);
22 ok($@, "autodie allows dbmopen to throw errors.");
23 isa_ok($@, "autodie::exception", "... errors are of the correct type");
25 like($@, ERROR_REGEXP, "Message should include number in octal, not decimal");
30 my %bar = ( foo => 1, bar => 2 );
32 dbmopen(%bar, "foo/bar/baz", 0666);
35 like($@, ERROR_REGEXP, "Correct formatting even with non-empty dbmopen hash");