aboutsummaryrefslogtreecommitdiff
path: root/libs/test.neb
blob: a07626fa826cac9a6624d03462b721f1c3e73387 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)))) "%)")))