diff options
| author | ruki <[email protected]> | 2026-01-21 00:00:00 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-01-21 00:00:00 +0800 |
| commit | 91843ffb82564d29ce9a9e386f2c9292620a5ba9 (patch) | |
| tree | e3b81ebb411c9f9ce6ae2b3357ccc6ae2363f334 /tests/modules/utf8/test.lua | |
| parent | 6eade15143027afad000a48c941f1e9168104a54 (diff) | |
improve utf8.lastof
Diffstat (limited to 'tests/modules/utf8/test.lua')
| -rw-r--r-- | tests/modules/utf8/test.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/modules/utf8/test.lua b/tests/modules/utf8/test.lua index 51b21d1c3..af0c98997 100644 --- a/tests/modules/utf8/test.lua +++ b/tests/modules/utf8/test.lua @@ -105,6 +105,15 @@ function test_lastof(t) t:are_equal(utf8.lastof("A你好A", "好"), 3) t:are_equal(utf8.lastof("ABC", "D"), nil) + + -- plain + 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) + + -- pattern + t:are_equal(utf8.lastof("ABC", "."), 3) + t:are_equal(utf8.lastof("你好", "."), 2) end function test_find(t) |
