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