aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-27 16:22:46 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-11-06 00:46:25 +0100
commite3f1be57b15f44abefe79e7da29c51d057ec7b0a (patch)
treea4cf07b94728685afc41b17db5a644b0bf5e3082
parentAdd tests for HTTP status codes. (diff)
downloadcalp-e3f1be57b15f44abefe79e7da29c51d057ec7b0a.tar.gz
calp-e3f1be57b15f44abefe79e7da29c51d057ec7b0a.tar.xz
Add some tests for vulgar.
-rw-r--r--tests/unit/vulgar/color.scm13
-rw-r--r--tests/unit/vulgar/vulgar.scm15
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit/vulgar/color.scm b/tests/unit/vulgar/color.scm
new file mode 100644
index 00000000..1dd2b4f3
--- /dev/null
+++ b/tests/unit/vulgar/color.scm
@@ -0,0 +1,13 @@
+(define-module (test vulgar-color)
+ :use-module (srfi srfi-64)
+ :use-module (srfi srfi-88)
+ :use-module (vulgar color))
+
+(test-equal "No color" "" (color-escape #f))
+
+;;; Extra with-output-to-string so escape sequences are escaped in error diff.
+(test-equal "Color"
+ (with-output-to-string (lambda () (write "\x1b[38;2;16;32;48m")))
+ (with-output-to-string (lambda () (write (color-escape "#102030")))))
+
+'((vulgar color))
diff --git a/tests/unit/vulgar/vulgar.scm b/tests/unit/vulgar/vulgar.scm
new file mode 100644
index 00000000..7771724f
--- /dev/null
+++ b/tests/unit/vulgar/vulgar.scm
@@ -0,0 +1,15 @@
+(define-module (test vulgar)
+ :use-module (srfi srfi-64)
+ :use-module (srfi srfi-88)
+ :use-module (vulgar))
+
+(test-equal "CLS"
+ "\x1b[H\x1b[J"
+ (with-output-to-string (lambda () (cls))))
+
+;;; Extra with-output-to-string so escape sequences are escaped in error diff.
+(test-equal "set-cursor-position"
+ (with-output-to-string (lambda () (write "\x1b[21;11H")))
+ (with-output-to-string (lambda () (write (with-output-to-string (lambda () (set-cursor-pos 10 20)))))))
+
+'((vulgar))