making (chibi term ansi) tests standalone to avoid circular dep on (chibi test)

This commit is contained in:
Alex Shinn 2016-03-19 15:15:28 +09:00
parent 57dd5464c5
commit 0251d14653
2 changed files with 35 additions and 3 deletions

View file

@ -1,9 +1,38 @@
(define-library (chibi term ansi-test)
(export run-tests)
(import (scheme base)
(chibi test)
(scheme write)
(chibi term ansi))
(begin
;; inline (chibi test) to avoid circular dependencies in snow
;; installations
(define-syntax test
(syntax-rules ()
((test expect expr)
(test 'expr expect expr))
((test name expect expr)
(guard (exn
(else
(display "!\nERROR: ")
(write name)
(newline)
(write exn)
(newline)))
(let* ((res expr)
(pass? (equal? expect expr)))
(display (if pass? "." "x"))
(cond
((not pass?)
(display "\nFAIL: ")
(write name)
(newline))))))))
(define-syntax test-assert
(syntax-rules ()
((test-assert expr) (test #t expr))))
(define-syntax test-error
(syntax-rules ()
((test-error expr)
(test-assert (guard (exn (else #t)) expr #f)))))
(define-syntax test-escape-procedure
(syntax-rules ()
((test-escape-procedure p s)
@ -25,6 +54,10 @@
(test (p "FOO")
s
(parameterize ((ansi-escapes-enabled? #t)) (p "FOO")))))))
(define (test-begin name)
(display name))
(define (test-end)
(newline))
(define (run-tests)
(test-begin "term.ansi")

View file

@ -35,7 +35,7 @@
(rename (chibi string-test) (run-tests run-string-tests))
(rename (chibi system-test) (run-tests run-system-tests))
(rename (chibi tar-test) (run-tests run-tar-tests))
(rename (chibi term ansi-test) (run-tests run-term-ansi-tests))
;;(rename (chibi term ansi-test) (run-tests run-term-ansi-tests))
(rename (chibi uri-test) (run-tests run-uri-tests))
;;(rename (chibi weak-test) (run-tests run-weak-tests))
)
@ -74,7 +74,6 @@
(run-show-tests)
(run-system-tests)
(run-tar-tests)
(run-term-ansi-tests)
(run-uri-tests)
(test-end)