From ff5b7a5feaa004f53de0b3330986b07bd5b90569 Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Mon, 18 May 2026 15:50:35 -0400 Subject: [PATCH] v1.0.0: add char-width tests to box-tests suite --- org/box-renderable.org | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/org/box-renderable.org b/org/box-renderable.org index 6fbf00e..d16bca0 100644 --- a/org/box-renderable.org +++ b/org/box-renderable.org @@ -335,6 +335,24 @@ objects and they are accessible via ~text-spans~. (is (= (length (text-spans tx)) 2)) (is (string= (span-text (elt (text-spans tx) 0)) "Hello")) (is-true (span-bold (elt (text-spans tx) 0))))) + +(test test-char-width-ascii + "ASCII characters (< 128) have width 1." + (is (= 1 (char-width #\a))) + (is (= 1 (char-width #\Space))) + (is (= 1 (char-width #\@)))) + +(test test-char-width-tab + "Tab character has width 8." + (is (= 8 (char-width #\Tab)))) + +(test test-char-width-cjk + "CJK characters have width 2." + (is (= 2 (char-width #\日)))) + +(test test-char-width-null + "Null character has width 0." + (is (= 0 (char-width #\Nul)))) #+END_SRC * Implementation