diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-12-17 09:31:11 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-12-17 09:31:11 +0000 |
commit | 38294c45e93c4b9374fd7503278ba8e3e030bb3c (patch) | |
tree | 354c7e08ce151de062ec50f693207b88ea9f1ae3 /t | |
parent | 04b0a66913c4569841be4ef05a48019f0924d4c2 (diff) | |
download | perl-38294c45e93c4b9374fd7503278ba8e3e030bb3c.tar.gz |
In dbmt_common.pl, change checkOutput(...) to 5 calls to is().
Replacing a 5 armed boolean fed to ok() with 5 calls to is() gives much better
diagnostics on failure.
Diffstat (limited to 't')
-rw-r--r-- | t/lib/dbmt_common.pl | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/t/lib/dbmt_common.pl b/t/lib/dbmt_common.pl index 268b0d68cb..7ebdfab1a0 100644 --- a/t/lib/dbmt_common.pl +++ b/t/lib/dbmt_common.pl @@ -232,10 +232,12 @@ unlink <Op_dbmx*>, $Dfile; sub checkOutput { my($fk, $sk, $fv, $sv) = @_; - return - $fetch_key eq $fk && $store_key eq $sk && - $fetch_value eq $fv && $store_value eq $sv && - $_ eq 'original'; + local $Test::Builder::Level = $Test::Builder::Level + 1; + is($fetch_key, $fk); + is($store_key, $sk); + is($fetch_value, $fv); + is($store_value, $sv); + is($_, 'original'); } unlink <Op_dbmx*>; @@ -251,17 +253,17 @@ unlink <Op_dbmx*>, $Dfile; $h{"fred"} = "joe"; # fk sk fv sv - ok(checkOutput("", "fred", "", "joe")); + checkOutput("", "fred", "", "joe"); ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; is($h{"fred"}, "joe"); # fk sk fv sv - ok(checkOutput("", "fred", "joe", "")); + checkOutput("", "fred", "joe", ""); ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; is($db->FIRSTKEY(), "fred"); # fk sk fv sv - ok(checkOutput("fred", "", "", "")); + checkOutput("fred", "", "", ""); # replace the filters, but remember the previous set my ($old_fk) = $db->filter_fetch_key @@ -276,17 +278,17 @@ unlink <Op_dbmx*>, $Dfile; ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; $h{"Fred"} = "Joe"; # fk sk fv sv - ok(checkOutput("", "fred", "", "Jxe")); + checkOutput("", "fred", "", "Jxe"); ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; is($h{"Fred"}, "[Jxe]"); # fk sk fv sv - ok(checkOutput("", "fred", "[Jxe]", "")); + checkOutput("", "fred", "[Jxe]", ""); ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; is($db->FIRSTKEY(), "FRED"); # fk sk fv sv - ok(checkOutput("FRED", "", "", "")); + checkOutput("FRED", "", "", ""); # put the original filters back $db->filter_fetch_key ($old_fk); @@ -296,15 +298,15 @@ unlink <Op_dbmx*>, $Dfile; ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; $h{"fred"} = "joe"; - ok(checkOutput("", "fred", "", "joe")); + checkOutput("", "fred", "", "joe"); ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; is($h{"fred"}, "joe"); - ok(checkOutput("", "fred", "joe", "")); + checkOutput("", "fred", "joe", ""); ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; is($db->FIRSTKEY(), "fred"); - ok(checkOutput("fred", "", "", "")); + checkOutput("fred", "", "", ""); # delete the filters $db->filter_fetch_key (undef); @@ -314,15 +316,15 @@ unlink <Op_dbmx*>, $Dfile; ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; $h{"fred"} = "joe"; - ok(checkOutput("", "", "", "")); + checkOutput("", "", "", ""); ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; is($h{"fred"}, "joe"); - ok(checkOutput("", "", "", "")); + checkOutput("", "", "", ""); ($fetch_key, $store_key, $fetch_value, $store_value) = ("") x 4; is($db->FIRSTKEY(), "fred"); - ok(checkOutput("", "", "", "")); + checkOutput("", "", "", ""); undef $db; untie %h; |