guile-reflow/tests/test-ansi.scm

26 lines
652 B
Scheme

(define-module (tests test-ansi)
#:use-module (reflow ansi)
#:use-module (tests utils)
#:use-module (srfi srfi-64)
#:use-module (rnrs io ports))
(test-begin "test-ansi")
(define pink-text-then-reset "\x1B[38;2;249;38;114m你好reflow\x1B[0m")
(test-equal
"Text should be forwarded to the port properly"
pink-text-then-reset
(call-with-output-string
(λ (str-port)
(define-values (ansi-port cur-seq reset restore)
(make-ansi-port-tuple str-port))
(display pink-text-then-reset ansi-port)
(reset)
(restore)
(test-equal "Current sequence should be #f" #f (cur-seq)))))
(test-end "test-ansi")