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")