scm: Support test failure expectation.

* module/mes/test.mes (result): Take second argument to mean expected
  failure count.
This commit is contained in:
Jan Nieuwenhuizen 2017-04-01 15:01:59 +02:00
parent 08c04ff845
commit 3b527affa3

View file

@ -34,11 +34,13 @@
(lambda (. t)
(cond ((or (null? t) (eq? (car t) result)) (list pass fail))
((eq? (car t) 'report)
(newline)
(display "passed: ") (display pass) (newline)
(display "failed: ") (display fail) (newline)
(display "total: ") (display (+ pass fail)) (newline)
(exit fail))
(let ((expect (if (null? (cdr t)) 0 (cadr t))))
(newline)
(display "passed: ") (display pass) (newline)
(display "failed: ") (display fail) (newline)
(if (not (eq? expect 0)) (begin (display "expect: ") (display expect) (newline)))
(display "total: ") (display (+ pass fail)) (newline)
(exit (if (eq? expect fail) 0 fail))))
((car t) (display ": pass") (newline) (set! pass (+ pass 1)))
(#t (display ": fail") (newline) (set! fail (+ fail 1)))))))