guile-reflow/tests/test-wrap.scm

39 lines
1.4 KiB
Scheme
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(define-module (tests test-wrap)
#:use-module (reflow wrap)
#:use-module (tests utils)
#:use-module (srfi srfi-64)
#:use-module (rnrs io ports))
(test-begin "test-wrap")
(verify-output
"hello ther\ne \x1b[3mHowdy! H\n\x1b[3mow are you\n\x1b[3m? \x1b[0mThis is \nfun, \x1b[5misn't\n\x1b[5m it tho?\x1b[0m\n I disa\ngree. I fi\nnd it \x1b[2mtedi\n\x1b[2mous\n"
(define port
(make-wrapping-port (current-output-port) 10 #:preserve-space? #t))
(display
"hello there \x1b[3mHowdy! How are you? \x1b[0mThis is fun, \x1b[5misn't it tho?\x1b[0m\n\tI disagree. I find it \x1b[2mtedious\n"
port))
;; Trans Rights 🏳️‍⚧️ Are Human Rights
;; But spiced up with bold and italic
;; Should look like
;; Trans Rights
;; 🏳️‍⚧️ Are Human R
;; ights
(verify-output
"\x1b[1m\x1b[3mTrans \x1b[0m\x1b[3mRights 🏳️\u200d\b \n\x1b[3m🏳 \x1b[0mAre \x1b[3mHuman \x1b[0mR\nights"
(define port
(make-wrapping-port (current-output-port) 14))
(display "\x1b[1m\x1b[3mTrans \x1b[0m\x1b[3mRights 🏳️‍⚧️ \x1b[0mAre \x1b[3mHuman \x1b[0mRights" port))
;; I wish i were
;; a, but then ag
;; ain, no
(verify-output
"I wish I were \na sculptor\b\b\b\b\b\b\b\b\b, but then ag\nain, no"
(define port
(make-wrapping-port (current-output-port) 14))
(display "I wish I were a sculptor\b\b\b\b\b\b\b\b\b, but then again, no" port))
(test-end "test-wrap")