aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/test.neb24
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/test.neb b/libs/test.neb
new file mode 100644
index 0000000..a07626f
--- /dev/null
+++ b/libs/test.neb
@@ -0,0 +1,24 @@
+(use "regex")
+
+(func testrunner ()
+ (testrunner "^test-"))
+
+(func testrunner (pattern :string)
+ (def passed 0)
+ (def total 0)
+ (for-each (filter (lambda (x) (match? pattern x)) (map ->string (user-funcs)))
+ (try
+ (block
+ ((first (parse-neb _item_)))
+ (redef passed (+ 1 passed))
+ (write "." _stdout_))
+ (print (concat (->string _item_) " " _panic_)))
+ (redef total (+ 1 total)))
+
+ (print "\nResults: ")
+ (print (concat " - Passed: " (->string passed)))
+ (print (concat " - Total " (->string total) " ("
+ (->string
+ (if (eq? 0 total)
+ 0
+ (* 100 (/ passed total)))) "%)")))