From 3b527affa35231304bb978cc28055a9a999219a9 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 1 Apr 2017 15:01:59 +0200 Subject: [PATCH] scm: Support test failure expectation. * module/mes/test.mes (result): Take second argument to mean expected failure count. --- module/mes/test.mes | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/module/mes/test.mes b/module/mes/test.mes index f6437e82..8c46fb6a 100644 --- a/module/mes/test.mes +++ b/module/mes/test.mes @@ -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))))))) -- 2.31.1