Commits

shl...@52c325ad-5fd0-0310-8a0f-c43feede02cc  committed 2628f14

Extracted the method $obj->_list_tests_as_failures().

  • Participants
  • Parent commits 3b2870a

Comments (0)

Files changed (1)

File modules/Test-Shlomif-Harness/lib/Test/Shlomif/Harness/Obj.pm

     }
 }
 
+sub _list_tests_as_failures
+{
+    my $self = shift;
+    my (%args) = @_;
+
+    my $test = $args{test_struct};
+    my $results = $args{results};
+
+    # List unrun tests as failures.
+    if ($test->{'next'} <= $test->{max}) {
+        push @{$test->{failed}}, $test->{'next'}..$test->{max};
+    }
+    # List overruns as failures.
+    else {
+        my $details = $results->{details};
+        foreach my $overrun ($test->{max}+1..@$details) {
+            next unless ref $details->[$overrun-1];
+            push @{$test->{failed}}, $overrun
+        }
+    }
+}
+
 sub _run_single_test
 {
     my ($self, %args) = @_;
         $self->_tot_inc('good');
     }
     else {
-        # List unrun tests as failures.
-        if ($test{'next'} <= $test{max}) {
-            push @{$test{failed}}, $test{'next'}..$test{max};
-        }
-        # List overruns as failures.
-        else {
-            my $details = $results{details};
-            foreach my $overrun ($test{max}+1..@$details) {
-                next unless ref $details->[$overrun-1];
-                push @{$test{failed}}, $overrun
-            }
-        }
- 
+        $self->_list_tests_as_failures(
+            'test_struct' => \%test,
+            'results' => \%results,
+        ); 
         $self->failed_tests()->{$tfile} = 
             $self->_get_failed_struct(
                 test_struct => \%test,