diff --git a/justfile b/justfile index 2332d58..3a01ec9 100644 --- a/justfile +++ b/justfile @@ -46,6 +46,16 @@ validate: --global-env-def "global_env" \ `find . -type f -iname '*.d.tl' | xargs` +test: build + rm -rf spec + mv build/spec spec + busted +# luarocks \ +# --lua-version {{ lua_version }} \ +# test \ +# --tree {{ rocks_tree }} \ +# {{ rockspec_file }} + # TODO : how to run a debugger on Teal code? debug: {{ lua }} debug.lua build/awesomewm.d.tl/init.lua diff --git a/spec/example_spec.tl b/src/spec/example_spec.tl similarity index 72% rename from spec/example_spec.tl rename to src/spec/example_spec.tl index e41f8fb..7448c7d 100644 --- a/spec/example_spec.tl +++ b/src/spec/example_spec.tl @@ -1,3 +1,5 @@ +local assert = require("luassert") + describe("Busted unit testing framework", function() describe("should be awesome", function() it("should be easy to use", function() @@ -6,14 +8,13 @@ describe("Busted unit testing framework", function() it("should have lots of features", function() -- deep check comparisons! - assert.are.same({ table = "great" }, { table = "great" }) + assert.same({ table = "great" }, { table = "great" }) -- or check by reference! - assert.are_not.equal({ table = "great" }, { table = "great" }) + assert.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) @@ -23,7 +24,7 @@ describe("Busted unit testing framework", function() end) it("should provide some shortcuts to common functions", function() - assert.are.unique { { thing = 1 }, { thing = 2 }, { thing = 3 } } + assert.is_unique { { thing = 1 }, { thing = 2 }, { thing = 3 } } end) end) end) diff --git a/tlconfig.lua b/tlconfig.lua index aafa9c4..54272d0 100644 --- a/tlconfig.lua +++ b/tlconfig.lua @@ -5,4 +5,5 @@ return { "src/awesomewm.d.tl", "types", }, + global_env_def = "busted", }