Compare commits
2 commits
e53876be52
...
59c9347bea
Author | SHA1 | Date | |
---|---|---|---|
59c9347bea | |||
ded13ff781 |
3 changed files with 42 additions and 3 deletions
3
hall.scm
3
hall.scm
|
@ -30,7 +30,8 @@
|
||||||
(scheme-file "internal")))))
|
(scheme-file "internal")))))
|
||||||
(tests ((directory
|
(tests ((directory
|
||||||
"tests"
|
"tests"
|
||||||
((scheme-file "test-eastasian-locale")))))
|
((scheme-file "test-eastasian-locale")
|
||||||
|
(scheme-file "test-uniseg")))))
|
||||||
(programs
|
(programs
|
||||||
((directory
|
((directory
|
||||||
"scripts"
|
"scripts"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
(test-begin "test-eastasian-locale")
|
(test-begin "test-eastasian-locale")
|
||||||
|
|
||||||
(define (test-east expected charset)
|
(define (test-eastasian-locale expected charset)
|
||||||
(test-equal
|
(test-equal
|
||||||
(format #f "check ~a" charset)
|
(format #f "check ~a" charset)
|
||||||
expected
|
expected
|
||||||
|
@ -21,6 +21,6 @@
|
||||||
(#t "ja_JP.CP932")
|
(#t "ja_JP.CP932")
|
||||||
(#f "en_US.UTF-8")))
|
(#f "en_US.UTF-8")))
|
||||||
|
|
||||||
(for-each (λ (p) (apply test-east p)) data)
|
(for-each (λ (p) (apply test-eastasian-locale p)) data)
|
||||||
|
|
||||||
(test-end "test-eastasian-locale")
|
(test-end "test-eastasian-locale")
|
||||||
|
|
38
tests/test-uniseg.scm
Normal file
38
tests/test-uniseg.scm
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
(define-module (tests test-uniseg)
|
||||||
|
#:use-module (uniseg)
|
||||||
|
#:use-module (srfi srfi-64))
|
||||||
|
|
||||||
|
(test-begin "test-uniseg")
|
||||||
|
|
||||||
|
(test-equal "linefeed"
|
||||||
|
'line-feed (char->grapheme-property #\x000a) )
|
||||||
|
|
||||||
|
(test-equal "zerowidth joiner"
|
||||||
|
'zero-width-joiner (char->grapheme-property #\x200d))
|
||||||
|
|
||||||
|
(test-equal "doublewidth"
|
||||||
|
2 (char-width #\〈))
|
||||||
|
|
||||||
|
(test-equal "japanese widths"
|
||||||
|
36 (string-width "トランスジェンダーの権利は人権です!"))
|
||||||
|
|
||||||
|
(test-equal "korean/hangul"
|
||||||
|
27 (string-width "트랜스젠더 권리는 인권이다!"))
|
||||||
|
|
||||||
|
(test-equal "ascii"
|
||||||
|
30 (string-width "Trans rights are human rights!"))
|
||||||
|
|
||||||
|
(test-equal "emoji"
|
||||||
|
33 (string-width "Trans 🏳️⚧️ rights are human rights!"))
|
||||||
|
|
||||||
|
(test-equal "cjk tone mark"
|
||||||
|
0 (char-width #\x302B))
|
||||||
|
|
||||||
|
;; TODO: get practical sentences, sorry to native speakers
|
||||||
|
(test-equal "cjk with tone mark"
|
||||||
|
2 (string-width "⺏〫"))
|
||||||
|
|
||||||
|
(test-equal "cjk tone mark property"
|
||||||
|
'extend (char->grapheme-property #\x302B))
|
||||||
|
|
||||||
|
(test-end "test-uniseg")
|
Loading…
Reference in a new issue