xtmtest   macro


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/test.xtm

Implementation

;; some tests are supposed to fail compilation (type check catch for example)
;; by passing 'copmile-should-fail as expected-result the failure will be marked as success
(define-macro (xtmtest form call . expected-result)
  `(let ((func-sym (quote ,(car call)))
         (exp-res ,(if (null? expected-result)
                       #f
                       (car expected-result))))
     (print-with-colors 'cyan 'default #t (print "xtmtest "))
     (print-with-colors 'black 'cyan #t (print "" func-sym ""))
     (println)
     (catch (if (and (symbol? exp-res)
                     (equal? exp-res 'compile-should-fail))
                (xtmtest-update-test-result func-sym 'correct ',call #f #f)
                (xtmtest-update-test-result func-sym 'no-compile ',call #f #f))
            (eval ',form (interaction-environment))
            (catch (xtmtest-update-test-result func-sym 'compile ',call #f #f)
                   (let ((result (eval ',call (interaction-environment))))
                     (if (or (not exp-res) (equal? exp-res result))
                         (xtmtest-update-test-result func-sym 'correct ',call exp-res result)
                         (xtmtest-update-test-result func-sym 'incorrect ',call exp-res result)))))))


Back to Index

Similar Entries

  • xtmtest    macro    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • xtmtest-compile    macro    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • xtmtest-compile    macro    /digego/extempore/tree/v0.8.9/libs/core/test.xtm
  • xtmtest-print-results    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • xtmtest-print-results    scheme    /digego/extempore/tree/v0.8.9/libs/core/test.xtm
  • xtmtest-reset-results    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • xtmtest-reset-results    scheme    /digego/extempore/tree/v0.8.9/libs/core/test.xtm
  • xtmtest-result    macro    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • xtmtest-result    macro    /digego/extempore/tree/v0.8.9/libs/core/test.xtm
  • xtmtest-result-body    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • xtmtest-result-body    scheme    /digego/extempore/tree/v0.8.9/libs/core/test.xtm
  • xtmtest-run-tests    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • xtmtest-run-tests    scheme    /digego/extempore/tree/v0.8.9/libs/core/test.xtm
  • xtmtest-update-test-result    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • xtmtest-update-test-result    scheme    /digego/extempore/tree/v0.8.9/libs/core/test.xtm
  • xtmtest-with-fixture    macro    /digego/extempore/tree/v0.8.9/libs/core/test.xtm
  • xtmtest-with-fixture-body    scheme    /digego/extempore/tree/v0.8.9/runtime/scheme.xtm
  • xtmtest-with-fixture-body    scheme    /digego/extempore/tree/v0.8.9/libs/core/test.xtm