diff options
Diffstat (limited to 'tests/modules/utf8/test.lua')
| -rw-r--r-- | tests/modules/utf8/test.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/modules/utf8/test.lua b/tests/modules/utf8/test.lua index f7c8dbd2e..ddbd6b639 100644 --- a/tests/modules/utf8/test.lua +++ b/tests/modules/utf8/test.lua @@ -110,6 +110,16 @@ function test_lastof(t) t:are_equal(utf8.lastof("ABC", "A", true), 1) t:are_equal(utf8.lastof("ABC", "B", true), 2) t:are_equal(utf8.lastof("ABC", ".", true), nil) + t:are_equal(utf8.lastof("你好", "好", true), 2) + t:are_equal(utf8.lastof("C你好D", "好", true), 3) + t:are_equal(utf8.lastof("C你好D", "D", true), 4) + + -- long string + local longstr = ("你"):rep(1000) .. "好" + t:are_equal(utf8.lastof(longstr, "好"), 1001) + t:are_equal(utf8.lastof(longstr, "你"), 1000) + t:are_equal(utf8.lastof(longstr, "好", true), 1001) + t:are_equal(utf8.lastof(longstr, "你", true), 1000) -- pattern t:are_equal(utf8.lastof("ABC", "."), 3) |
