wip: try some stuff
ci/woodpecker/pr/lint Pipeline was successful Details
ci/woodpecker/pr/build Pipeline was successful Details

This commit is contained in:
Aire-One 2022-10-30 15:11:14 +01:00
parent b4d6aa5228
commit a12d5224b5
7 changed files with 55 additions and 1 deletions

6
.busted Normal file
View File

@ -0,0 +1,6 @@
return {
default = {
-- lua = "tl run",
helper = "run-busted.lua",
},
}

View File

@ -14,6 +14,9 @@ indent_size = 3
[*.{tl,d.tl}]
indent_size = 3
[.busted]
indent_size = 3
[justfile]
indent_size = 2

View File

@ -30,6 +30,7 @@
],
"files.associations": {
".luacheckrc": "lua",
"*.rockspec": "lua"
"*.rockspec": "lua",
".busted": "lua"
}
}

View File

@ -1,3 +1,4 @@
rockspec_format = "3.0"
package = "awesomewm.d.tl"
version = "dev-1"
source = {
@ -17,7 +18,13 @@ dependencies = {
"luasocket 3.1.0-1",
"luasec 1.2.0-1",
}
test_dependencies = {
"busted",
}
build = {
type = "builtin",
modules = {},
}
test = {
type = "busted",
}

3
run-busted.lua Normal file
View File

@ -0,0 +1,3 @@
local tl = require "tl"
tl.loader()
print "helper"

29
spec/example_spec.tl Normal file
View File

@ -0,0 +1,29 @@
describe("Busted unit testing framework", function()
describe("should be awesome", function()
it("should be easy to use", function()
assert.truthy "Yup."
end)
it("should have lots of features", function()
-- deep check comparisons!
assert.are.same({ table = "great" }, { table = "great" })
-- or check by reference!
assert.are_not.equal({ table = "great" }, { table = "great" })
assert.truthy "this is a string" -- truthy: not false or nil
assert.True(1 == 1)
assert.is_true(1 == 1)
assert.falsy(nil)
assert.has_error(function()
error "Wat"
end, "Wat")
end)
it("should provide some shortcuts to common functions", function()
assert.are.unique { { thing = 1 }, { thing = 2 }, { thing = 3 } }
end)
end)
end)

5
spec/runner.lua Normal file
View File

@ -0,0 +1,5 @@
require "busted.runner"()
local tl = require "tl"
tl.loader()
dofile "spec/example_spec.tl"