Skip to content

Commit

Permalink
add initial (dummy) tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Mar 7, 2021
1 parent 1a0f781 commit 0139520
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
globals = {
"blockexchange",
"worldedit"
"worldedit",
["minetest"] = {
["request_http_api"] = true
}
}

read_globals = {
Expand All @@ -15,5 +18,8 @@ read_globals = {
"VoxelArea",

-- opt deps
"areas", "monitoring"
"areas", "monitoring",

-- testing
"mineunit", "sourcefile", "assert"
}
Empty file added spec/mineunit.conf
Empty file.
22 changes: 22 additions & 0 deletions spec/sort_pos_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require("mineunit")

mineunit("core")
mineunit("player")
mineunit("default/functions")

minetest.request_http_api = function()
return {}
end

sourcefile("init")

describe("blockexchange.sort_pos", function()
it("returns proper coordinates", function()
local pos1 = {x=1, y=2, z=3}
local pos2 = {x=0, y=0, z=0}
pos1, pos2 = blockexchange.sort_pos(pos1, pos2)
assert.not_nil(pos1)
assert.not_nil(pos2)
assert.equals(0, pos1.x)
end)
end)

0 comments on commit 0139520

Please sign in to comment.