ref: d3ab6d19ae584c5b10d8d7391811f3f26880aa50
parent: 0f945628a2af04425ddfd3117b890c6168eeb381
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jun 19 16:02:52 EDT 2016
Make substest implementation match documentation. We should finish `ntests` by the time we hit the next MTEST test plan line.
--- a/mbld/subtest.myr
+++ b/mbld/subtest.myr
@@ -12,7 +12,7 @@
const __init__ = { planpat = std.try(regex.compile("MTEST\\s+(-?\\d+)\\s*"))- headpat = std.try(regex.compile("test\\s+(.*)<<{!"))+ headpat = std.try(regex.compile("test\\s+(.*)<<{!\\s*")) footpat = std.try(regex.compile("!}>>\\s*(ok|fail\\s*(.*))\\s*"))}
@@ -94,7 +94,10 @@
| `std.None:
| `std.Some n:
if curtest.len == 0
- ntests += n
+ if !checktests(ntests, nresults)
+ ok = false
+ ;;
+ ntests = n
continue
;;
;;
@@ -101,11 +104,18 @@
bio.put(log, "\t{}\n", ln);;
+ if !checktests(ntests, nresults)
+ ok = false
+ ;;
+ -> ok
+}
+
+const checktests = {ntests, nresultsif ntests > 0 && ntests != nresults
std.put("mismatched test count: expected {}, got {}\n", ntests, nresults)-> false
;;
- -> ok
+ -> true
}
const starttest = {curtest, t--
⑨