aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/CMakeLists.txt
diff options
context:
space:
mode:
authorStas Kies <stask85@gmail.com>2019-12-25 11:59:34 +0000
committerrubenwardy <rw@rubenwardy.com>2020-01-10 18:57:47 +0000
commit1102b1fc4c33c3a5b266cae4826c6dd9dfa9a9e9 (patch)
tree1cfae96eb600724262dbff2fa54db178477b270f /src/script/cpp_api/CMakeLists.txt
parent0d089eab2104ab1909b752096cc07b7035024f54 (diff)
downloadminetest-1102b1fc4c33c3a5b266cae4826c6dd9dfa9a9e9.tar.gz
minetest-1102b1fc4c33c3a5b266cae4826c6dd9dfa9a9e9.tar.bz2
minetest-1102b1fc4c33c3a5b266cae4826c6dd9dfa9a9e9.zip
Translated using Weblate (German)
Currently translated at 100.0% (1274 of 1274 strings)
Diffstat (limited to 'src/script/cpp_api/CMakeLists.txt')
0 files changed, 0 insertions, 0 deletions
hl esc">\t ")) end) describe("split()", function() it("removes empty", function() assert.same({ "hello" }, string.split("hello")) assert.same({ "hello", "world" }, string.split("hello,world")) assert.same({ "hello", "world" }, string.split("hello,world,,,")) assert.same({ "hello", "world" }, string.split(",,,hello,world")) assert.same({ "hello", "world", "2" }, string.split("hello,,,world,2")) assert.same({ "hello ", " world" }, string.split("hello :| world", ":|")) end) it("keeps empty", function() assert.same({ "hello" }, string.split("hello", ",", true)) assert.same({ "hello", "world" }, string.split("hello,world", ",", true)) assert.same({ "hello", "world", "" }, string.split("hello,world,", ",", true)) assert.same({ "hello", "", "", "world", "2" }, string.split("hello,,,world,2", ",", true)) assert.same({ "", "", "hello", "world", "2" }, string.split(",,hello,world,2", ",", true)) assert.same({ "hello ", " world | :" }, string.split("hello :| world | :", ":|")) end) it("max_splits", function() assert.same({ "one" }, string.split("one", ",", true, 2)) assert.same({ "one,two,three,four" }, string.split("one,two,three,four", ",", true, 0)) assert.same({ "one", "two", "three,four" }, string.split("one,two,three,four", ",", true, 2)) assert.same({ "one", "", "two,three,four" }, string.split("one,,two,three,four", ",", true, 2)) assert.same({ "one", "two", "three,four" }, string.split("one,,,,,,two,three,four", ",", false, 2)) end) it("pattern", function() assert.same({ "one", "two" }, string.split("one,two", ",", false, -1, true)) assert.same({ "one", "two", "three" }, string.split("one2two3three", "%d", false, -1, true)) end) end) end) describe("privs", function() it("from string", function() assert.same({ a = true, b = true }, core.string_to_privs("a,b")) end) it("to string", function() assert.equal("one", core.privs_to_string({ one=true })) local ret = core.privs_to_string({ a=true, b=true }) assert(ret == "a,b" or ret == "b,a") end) end) describe("pos", function() it("from string", function() assert.equal(vector.new(10, 5.1, -2), core.string_to_pos("10.0, 5.1, -2")) assert.equal(vector.new(10, 5.1, -2), core.string_to_pos("( 10.0, 5.1, -2)")) assert.is_nil(core.string_to_pos("asd, 5, -2)")) end) it("to string", function() assert.equal("(10.1,5.2,-2.3)", core.pos_to_string({ x = 10.1, y = 5.2, z = -2.3})) end) end) describe("table", function() it("indexof()", function() assert.equal(1, table.indexof({"foo", "bar"}, "foo")) assert.equal(-1, table.indexof({"foo", "bar"}, "baz")) end) end)