diff options
| author | ruki <[email protected]> | 2020-09-29 00:35:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-09-29 00:35:13 +0800 |
| commit | 675fc8fca1e62f24e505523eb1b8e0523a9ffb94 (patch) | |
| tree | 61da761bba308ade0ce8455c674e792822c71c86 /tests/modules/string/test.lua | |
| parent | d662c54d57accd1382c2368e3c7f27832d9ef10d (diff) | |
improve cmake/install and add string.replace
Diffstat (limited to 'tests/modules/string/test.lua')
| -rw-r--r-- | tests/modules/string/test.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/modules/string/test.lua b/tests/modules/string/test.lua index 09a0f5a3e..3f52dc593 100644 --- a/tests/modules/string/test.lua +++ b/tests/modules/string/test.lua @@ -95,3 +95,14 @@ function test_lastof(t) t:are_equal(("/home/file.txt"):lastof('/home', true), 1) t:are_equal(("/home/file.txt"):lastof('[/\\]home'), 1) end + +function test_replace(t) + t:are_equal(("123xyz456xyz789xyz"):replace("123", "000"), "000xyz456xyz789xyz") + t:are_equal(("123xyz456xyz789xyz"):replace("xyz", "000"), "123000456000789000") + t:are_equal(("123xyz456xyz789xyz"):replace("123", "000", {plain = true}), "000xyz456xyz789xyz") + t:are_equal(("123xyz456xyz789xyz"):replace("xyz", "000", {plain = true}), "123000456000789000") + t:are_equal(("123$xyz456xyz789xyz"):replace("123$", "000"), "123$xyz456xyz789xyz") + t:are_equal(("123xyz$456xyz$789xyz$"):replace("xyz$", "000"), "123xyz$456xyz$789xyz$") + t:are_equal(("123$xyz456xyz789xyz"):replace("123$", "000", {plain = true}), "000xyz456xyz789xyz") + t:are_equal(("123xyz$456xyz$789xyz$"):replace("xyz$", "000", {plain = true}), "123000456000789000") +end |
