Permalink
Browse files

Distinct tests for failures struct

  • Loading branch information...
1 parent 1552be8 commit 9172f4458f4b3e7965b8f0824bc8c1b2bda1eebf @tamias tamias committed Jul 6, 2011
Showing with 21 additions and 11 deletions.
  1. +17 −10 perl/t/lib/Test/RxTester.pm
  2. +1 −1 spec/spec.json
  3. +3 −0 util/rebuild-tests.pl
@@ -104,6 +104,9 @@ sub assert_fail {
try {
$schema->validate($input);
Test::More::fail($desc);
+ if ($want_struct) {
+ Test::More::fail("$desc, failures struct");
+ }
} catch {
my $fails = $_;
my $ok = 1;
@@ -141,16 +144,6 @@ sub assert_fail {
}
- if ($want_struct) {
- my ($tmp_ok, $stack) =
- cmp_details($want_struct,$fails->build_struct);
- $tmp_ok
- or do {
- $ok = 0;
- push @diag, "errors struct does not match", deep_diag($stack);
- };
- }
-
} else {
$ok = 0;
my $desc = Scalar::Util::blessed($fails)
@@ -166,6 +159,20 @@ sub assert_fail {
Test::More::ok($ok, $desc);
Test::More::diag " $_" for @diag;
+
+ if ($want_struct) {
+ my ($ok, $stack) =
+ cmp_details($want_struct,$fails->build_struct);
+
+ my @diag;
+
+ if (!$ok) {
+ push @diag, "errors struct does not match", deep_diag($stack);
+ }
+
+ Test::More::ok($ok, "$desc, failures struct");
+ Test::More::diag " $_" for @diag;
+ }
}
}
View
@@ -1,5 +1,5 @@
{
- "count" : 1625,
+ "count" : 1633,
"tests" : {
"all-2recs" : {
"schema" : {
View
@@ -74,6 +74,9 @@
};
$count += 1;
+
+ $count += 1
+ if $pf eq 'fail' and $expect->{$entry}{'errors_struct'};
}
$test_set{ $name } = $set;

0 comments on commit 9172f44

Please sign in to comment.