Commits

Alex Suraci  committed b5512fb

show stats after the tests are complete
Ignore-this: 173f0d406a58e24a036eb85871155ca2

  • Participants
  • Parent commits 8d59b2c

Comments (0)

Files changed (1)

 
 { main |
     nesting-level = Parameter new: 0
+    stats = Object clone do: {
+        failed = 0
+        passed = 0
+    }
+
+    (main) theorize: as := {
+        stats do: {
+            failed = 0
+            passed = 0
+        }
+
+        as call
+        "" print
+
+        stats do: {
+            [
+                "total of", (failed + passed) show, "tests",
+                "(" .. (passed show ansi-colored: @green), "passed,"
+                failed show ansi-colored: @red, "failed)"
+            ] unwords print
+        }
+    } call
 
     o should: (check: Particle) :=
         when: (check call: [o]) not
     (main) it: description so: checks := {
         {
             checks call
+            stats passed = stats passed + 1
             (indentation .. "✓ " .. description) (ansi-colored: @green) print
         } catch: { e |
+            stats failed = stats failed + 1
             (indentation .. "✗ " .. description) (ansi-colored: @red) print
             (indentation .. "  ` " .. e show) (ansi-colored: @yellow) print
         }