diff options
Diffstat (limited to 'util/text/text_test.go')
-rw-r--r-- | util/text/text_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/util/text/text_test.go b/util/text/text_test.go index 96234464..cda26fda 100644 --- a/util/text/text_test.go +++ b/util/text/text_test.go @@ -89,6 +89,18 @@ func TestWrap(t *testing.T) { " This\nis a\nlist:\n\n\n *\nfoo\n *\nbar\n\n\n *\nbaz\nBAM\n", 6, }, + // Handle chinese + { + "婞一枳郲逴靲屮蜧曀殳,掫乇峔掮傎溒兀緉冘仜。", + "婞一枳郲逴靲屮蜧曀殳,掫\n乇峔掮傎溒兀緉冘仜。", + 12, + }, + // Handle chinese with colors + { + "婞一枳郲逴\x1b[31m靲屮蜧曀殳,掫乇峔掮傎溒\x1b[0m兀緉冘仜。", + "婞一枳郲逴\x1b[31m靲屮蜧曀殳,掫\n乇峔掮傎溒\x1b[0m兀緉冘仜。", + 12, + }, } for i, tc := range cases { @@ -126,6 +138,16 @@ func TestWordLen(t *testing.T) { "foo\x1b[31mfoobarHoy\x1b[0mbaaar", 17, }, + // Handle chinese + { + "快檢什麼望對", + 6, + }, + // Handle chinese with colors + { + "快\x1b[31m檢什麼\x1b[0m望對", + 6, + }, } for i, tc := range cases { @@ -179,6 +201,18 @@ func TestSplitWord(t *testing.T) { 0, "", "foo", }, + // Handle chinese + { + "快檢什麼望對", + 2, + "快檢", "什麼望對", + }, + // Handle chinese with colors + { + "快\x1b[31m檢什麼\x1b[0m望對", + 2, + "快\x1b[31m檢", "什麼\x1b[0m望對", + }, } for i, tc := range cases { |