diff options
author | Lars Müller <34514239+appgurueu@users.noreply.github.com> | 2022-05-27 21:40:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-27 21:40:38 +0200 |
commit | e8b2954586ebd9e35e3f9f7230ff6713b65c4967 (patch) | |
tree | 11b7af3b40340ba499b3523f7ff0e585cde6c6c2 /builtin/common/tests | |
parent | fe299e24d6ad5bb58e077ec372737b117ac6cf94 (diff) | |
download | minetest-e8b2954586ebd9e35e3f9f7230ff6713b65c4967.tar.gz minetest-e8b2954586ebd9e35e3f9f7230ff6713b65c4967.tar.bz2 minetest-e8b2954586ebd9e35e3f9f7230ff6713b65c4967.zip |
Builtin: Optimize misc helpers (#12377)
Also add formspec_escape unit test
Diffstat (limited to 'builtin/common/tests')
-rw-r--r-- | builtin/common/tests/misc_helpers_spec.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin/common/tests/misc_helpers_spec.lua b/builtin/common/tests/misc_helpers_spec.lua index f6ad96619..7d046d5b7 100644 --- a/builtin/common/tests/misc_helpers_spec.lua +++ b/builtin/common/tests/misc_helpers_spec.lua @@ -163,3 +163,11 @@ describe("table", function() assert.equal(-1, table.indexof({"foo", "bar"}, "baz")) end) end) + +describe("formspec_escape", function() + it("escapes", function() + assert.equal(nil, core.formspec_escape(nil)) + assert.equal("", core.formspec_escape("")) + assert.equal("\\[Hello\\\\\\[", core.formspec_escape("[Hello\\[")) + end) +end) |