xtmtest-result-body   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/scheme.xtm

Implementation

(define (xtmtest-result-body call expected-result extra)
  (let ((prefix (if (null? extra) "" (format "~a: " (car extra)))))
    `(let ((evaluation-environment (current-environment))
           (test-name (format "~a ~a" ,prefix ',(if (pair? call) (car call) call))))
       (print-with-colors 'cyan 'default #t (print "xtmtest "))
       (print-with-colors 'black 'cyan #t (print "" test-name ))
       (println)
       (catch (xtmtest-update-test-result test-name ',call 'compile #f #f)
              (let ((result (eval ',call evaluation-environment)))
                (if (equal? ,expected-result result)
                    (xtmtest-update-test-result ',prefix 'correct ',call ,expected-result result)
                    (xtmtest-update-test-result ',prefix 'incorrect ',call ,expected-result result))))))  )


Back to Index

Similar Entries

  • xtmtest-result-body    scheme