diff options
| author | mryouse | 2022-07-22 00:49:21 +0000 |
|---|---|---|
| committer | mryouse | 2022-07-22 00:49:21 +0000 |
| commit | 5a836ce9f31451fbaf0147b0c03d2593e9accaa3 (patch) | |
| tree | 20a577a062a9daac54542594725dbf433e7411b2 /libs | |
| parent | 082eb2245a971b414ca41653e072e8d75e286fc7 (diff) | |
initial commit of a test runner
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/test.neb | 24 |
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)))) "%)"))) |
