1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-12 16:15:20 +02:00

Builtin: Optimize misc helpers (#12377)

Also add formspec_escape unit test
This commit is contained in:
Lars Müller
2022-05-27 21:40:38 +02:00
committed by GitHub
parent fe299e24d6
commit e8b2954586
3 changed files with 31 additions and 20 deletions

View File

@@ -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)