test: utils

This commit is contained in:
Smirnov Oleksandr 2023-07-20 20:05:22 +03:00
parent 1ce9244c52
commit a2959e8446

View file

@ -1,19 +1,25 @@
describe("gopher._utils", function() describe("gopher._utils", function()
it("can be requried", function() local u = require "gopher._utils"
require "gopher._utils"
describe(".is_tbl_empty()", function()
it("it is empty", function()
assert.are.same(true, u.is_tbl_empty {})
end)
it("it is not empty", function()
assert.are.same(false, u.is_tbl_empty { first = "1", second = 2 })
end)
end) end)
it(".empty() with non-empty talbe", function() describe(".sreq()", function()
local empty = require("gopher._utils").empty it("can require existing module", function()
local res = empty { first = "1", second = 2 } assert.are.same(require "gopher", u.sreq "gopher")
end)
assert.are.same(res, false) it("cannot require non-existing module", function()
end) assert.has.errors(function()
u.sreq "iDontExistBtw"
it(".empty() with empty talbe", function() end)
local empty = require("gopher._utils").empty end)
local res = empty {}
assert.are.same(res, true)
end) end)
end) end)