summaryrefslogtreecommitdiff
path: root/tests/modules/string/test.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modules/string/test.lua')
-rw-r--r--tests/modules/string/test.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/modules/string/test.lua b/tests/modules/string/test.lua
index 94b3c1a04..4b093de45 100644
--- a/tests/modules/string/test.lua
+++ b/tests/modules/string/test.lua
@@ -94,6 +94,13 @@ function test_lastof(t)
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)
+
+ -- long string
+ local longstr = ("a"):rep(1000) .. "b"
+ t:are_equal(longstr:lastof("b"), 1001)
+ t:are_equal(longstr:lastof("a"), 1000)
+ t:are_equal(longstr:lastof("b", true), 1001)
+ t:are_equal(longstr:lastof("a", true), 1000)
end
function test_replace(t)