From d509aa254d650193a5a01d3f038d0692333f751b Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Thu, 29 Feb 2024 11:13:10 -0500 Subject: [PATCH] Second unit test --- tests/test-ansi.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test-ansi.scm b/tests/test-ansi.scm index 9dfedf7..ccd1ade 100644 --- a/tests/test-ansi.scm +++ b/tests/test-ansi.scm @@ -22,4 +22,28 @@ (test-equal "Current sequence should be #f" #f (cur-seq))))) + +(test-equal + "Text should contain a bold sequence with only one reset sequence" + "\x1b[1mhello\x1b[0m你好" + (call-with-output-string + (λ (str-port) + (define-values (ansi-port cur-seq reset restore) + (make-ansi-port-tuple str-port)) + + ;; no-op reset + (reset) + + (display "\x1b[1mhello" ansi-port) + + (test-equal "cur-seq should have bold" + "\x1b[1m" + (cur-seq)) + + ;; op reset + (reset) + + (display "你好" ansi-port)))) + + (test-end "test-ansi")