diff options
| author | ruki <[email protected]> | 2020-03-18 22:50:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-03-18 11:00:17 +0800 |
| commit | a6c0dcf25be88e82d68edd8ae9dba529e31ade0a (patch) | |
| tree | 7e807d282225c19c6df8c8e8bdc335f4ef426d68 /tests/modules/string/test.lua | |
| parent | dd941c7ecac8c9d500660ed7ffc1af36b2ba54b6 (diff) | |
add string.lastof tests
Diffstat (limited to 'tests/modules/string/test.lua')
| -rw-r--r-- | tests/modules/string/test.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/modules/string/test.lua b/tests/modules/string/test.lua index 57e00dd7e..09a0f5a3e 100644 --- a/tests/modules/string/test.lua +++ b/tests/modules/string/test.lua @@ -86,3 +86,12 @@ function test_split(t) t:are_equal((""):split('123', {plain = true, limit = 2, strict = true}), {""}) t:are_equal(("123123"):split('123', {plain = true, limit = 2, strict = true}), {"", "123"}) end + +function test_lastof(t) + t:are_equal(("1.2.3.4.5"):lastof('%.'), 8) + t:are_equal(("1.2.3.4.5"):lastof('.', true), 8) + t:are_equal(("/home/file.txt"):lastof('[/\\]'), 6) + t:are_equal(("/home/file.txt"):lastof('/', true), 6) + t:are_equal(("/home/file.txt"):lastof('/home', true), 1) + t:are_equal(("/home/file.txt"):lastof('[/\\]home'), 1) +end |
