Commits

Anonymous committed 201b7d7

Some refactoring.

Comments (0)

Files changed (2)

modules/Test-Shlomif-Harness/check-manifest.sh

 #!/bin/bash
 cat file-list.txt | grep -v '/$' | sort | diff -u MANIFEST - |
-    grep -vP '^\+bin/prove$' | grep -vF META.yml | grep -v '^ ' |
-    grep -vP '^(\+\+\+|\-\-\-|@@)'  
+    grep -vP '^\+bin/prove$' | grep -vP '^\+check-manifest\.sh$' |
+    grep -vF META.yml | grep -v '^ ' | grep -vP '^(\+\+\+|\-\-\-|@@)'

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

       ($self->{bailout_reason} ? ": $self->{bailout_reason}\n" : ".\n");
 };
 
+sub _get_s
+{
+    my ($self, $n) = @_;
+    return ($n != 1 ? 's' : '')
+}
+
+sub _get_skipped_bonusmsg
+{
+    my $self = shift;
+    my $tot = $self->tot();
+
+    my $sub_skipped_msg =
+        "$tot->{sub_skipped} subtest" . $self->_get_s($tot->{sub_skipped});
+    if ($tot->{skipped}) {
+        return 
+            ", $tot->{skipped} test" .
+            $self->_get_s($tot->{skipped}) .
+            ($tot->{sub_skipped} ? (" and " . $sub_skipped_msg) : "") .
+            ' skipped'
+            ;
+    }
+    elsif ($tot->{sub_skipped}) {
+        return "$sub_skipped_msg skipped";
+    }
+}
+
 sub _get_bonusmsg {
     my($self) = @_;
     my $tot = $self->tot();
                " UNEXPECTEDLY SUCCEEDED)")
         if $tot->{bonus};
 
-    if ($tot->{skipped}) {
-        $bonusmsg .= ", $tot->{skipped} test"
-                     . ($tot->{skipped} != 1 ? 's' : '');
-        if ($tot->{sub_skipped}) {
-            $bonusmsg .= " and $tot->{sub_skipped} subtest"
-                         . ($tot->{sub_skipped} != 1 ? 's' : '');
-        }
-        $bonusmsg .= ' skipped';
-    }
-    elsif ($tot->{sub_skipped}) {
-        $bonusmsg .= ", $tot->{sub_skipped} subtest"
-                     . ($tot->{sub_skipped} != 1 ? 's' : '')
-                     . " skipped";
-    }
+    $bonusmsg .= $self->_get_skipped_bonusmsg();
 
     $self->_bonusmsg($bonusmsg);