Add some tests, these fail because things are not quite right

This commit is contained in:
Vivianne 2024-03-05 23:34:38 -05:00
parent 011ea03f87
commit 47fd2e46dd

31
tests/test-wrap.scm Normal file
View file

@ -0,0 +1,31 @@
(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-values (port reset)
(make-wrapping-port-pair (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\b\n\x1b[1m;3m🏳 \x1b[0mAre \x1b[3mHuman \x1b[0mR\nights"
(define-values (port reset)
(make-wrapping-port-pair (current-output-port) 14))
(display "\x1b[1m\x1b[3mTrans \x1b[0m\x1b[3mRights 🏳️‍⚧️ \x1b[0mAre \x1b[3mHuman \x1b[0mRights" port))
(test-end "test-wrap")