From 197dfb660a35825d0bb46f8ef69884d7ec00c410 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 21 Jan 2026 22:09:09 +0800 Subject: fix path.filename and lastof --- tests/modules/utf8/test.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/modules/utf8/test.lua') 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) -- cgit v1.3.1