diff --git a/hall.scm b/hall.scm index d9889c6..3d4cf0f 100644 --- a/hall.scm +++ b/hall.scm @@ -18,14 +18,17 @@ (licensing #f))) (files (libraries ((directory - "termenv" - ((scheme-file "style") - (scheme-file "unix") - (scheme-file "hyperlink") - (scheme-file "screen") - (scheme-file "color") - (scheme-file "hconfig"))) - (scheme-file "termenv"))) + "termenv" + ((scheme-file "style") + (scheme-file "unix") + (scheme-file "hyperlink") + (scheme-file "screen") + (scheme-file "color") + (scheme-file "hconfig"))) + (scheme-file "termenv") + (directory + "tests" + ((scheme-file "utils"))))) (tests ((directory "tests" ((scheme-file "test-screen") diff --git a/tests/test-screen.scm b/tests/test-screen.scm index e83d94a..ba870cc 100644 --- a/tests/test-screen.scm +++ b/tests/test-screen.scm @@ -1,5 +1,6 @@ (define-module (tests test-screen) #:use-module (termenv screen) + #:use-module (tests utils) #:use-module (srfi srfi-64) #:use-module (rnrs io ports) #:use-module (scheme base) @@ -7,13 +8,9 @@ (test-begin "test-screen") -(define (output-equal expected) - "Ensures that the output sequence is what is expected" - (define vec (get-output-bytevector (current-output-port))) - (define str (bytevector->string vec (native-transcoder))) - (test-equal str expected)) +(verify-output + "\x1b[0m" + (reset (current-output-port))) -(parameterize ((current-output-port (open-output-bytevector))) - #f) (test-end "test-screen") diff --git a/tests/test-style.scm b/tests/test-style.scm index f8d8286..a441de0 100644 --- a/tests/test-style.scm +++ b/tests/test-style.scm @@ -1,5 +1,6 @@ (define-module (tests test-style) #:use-module (termenv style) + #:use-module (tests utils) #:use-module (srfi srfi-64) #:use-module (rnrs io ports) #:use-module (scheme base) @@ -7,18 +8,6 @@ (test-begin "test-style") -(define (verify-output-fn expected proc) - "Ensures that the output sequence is what is expected" - (test-equal - expected - (call-with-output-string - (λ (port) - (parameterize ((current-output-port port)) - (proc)))))) - -(define-syntax-rule (verify-output expected body ...) - (verify-output-fn expected (lambda () body ...))) - (verify-output "hello there" (format #t "~a" (make-style "hello there"))) diff --git a/tests/utils.scm b/tests/utils.scm new file mode 100644 index 0000000..5bd511d --- /dev/null +++ b/tests/utils.scm @@ -0,0 +1,15 @@ +(define-module (tests utils) + #:use-module (srfi srfi-64) + #:export (verify-output)) + +(define (verify-output-fn expected proc) + "Ensures that the output sequence is what is expected" + (test-equal + expected + (call-with-output-string + (λ (port) + (parameterize ((current-output-port port)) + (proc)))))) + +(define-syntax-rule (verify-output expected body ...) + (verify-output-fn expected (lambda () body ...)))