diff options
| author | ruki <[email protected]> | 2026-01-21 22:09:09 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-01-21 22:09:09 +0800 |
| commit | 197dfb660a35825d0bb46f8ef69884d7ec00c410 (patch) | |
| tree | 271f4bce14ac31a35f89c7df2e51c27b27025043 /tests/modules/utf8 | |
| parent | 3a602442ced657fd07d9890176f1bc24ea1b346f (diff) | |
fix path.filename and lastof
Diffstat (limited to 'tests/modules/utf8')
| -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) |
