-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
175 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
return { | ||
_all = { | ||
helper = "spec/helper.lua", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
busted: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Run Busted | ||
uses: lunarmodules/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ std = "min" | |
cache = true | ||
|
||
include_files = { | ||
".busted", | ||
".luacheckrc", | ||
"*.rockspec", | ||
"src/", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,6 @@ lint: luacheck stylua ldoc-dryrun cspell lint-rockspec | |
|
||
ldoc: | ||
ldoc . | ||
|
||
test: | ||
luarocks test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- Fake awesome modules | ||
package.loaded["gears.table"] = { | ||
hasitem = function(t, item) | ||
for k, v in pairs(t) do | ||
if v == item then | ||
return k | ||
end | ||
end | ||
end, | ||
} | ||
|
||
package.loaded["ruled.client"] = {} | ||
|
||
package.loaded["ruled.notification"] = {} | ||
|
||
package.loaded["awful.keyboard"] = { | ||
append_client_keybindings = function() end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
local slot = require "awesome-slot" | ||
|
||
local function new_target() | ||
return { | ||
connect_signal = spy.new(function() end), | ||
disconnect_signal = spy.new(function() end), | ||
} | ||
end | ||
|
||
describe("Awesome-slot", function() | ||
it("should create slot", function() | ||
local target = new_target() | ||
|
||
local s = slot { | ||
target = target, | ||
signal = "signal", | ||
slot = function() end, | ||
slot_params = { key = "value" }, | ||
} | ||
|
||
assert.is_not_nil(s) | ||
end) | ||
|
||
it("should remove slot", function() | ||
local target = new_target() | ||
|
||
local s = slot { | ||
target = target, | ||
signal = "signal", | ||
slot = function() end, | ||
slot_params = { key = "value" }, | ||
} | ||
|
||
slot.remove(s) | ||
|
||
assert.is_nil(slot.get_slot(s)) | ||
end) | ||
|
||
it("should connect slot (from constructor parameters)", function() | ||
local target = new_target() | ||
|
||
local s = slot { | ||
target = target, | ||
signal = "signal", | ||
slot = function() end, | ||
slot_params = { key = "value" }, | ||
connect = true, | ||
} | ||
|
||
assert.is_true(s.connected) | ||
end) | ||
|
||
it("should connect signal", function() | ||
local target = new_target() | ||
|
||
local s = slot { | ||
target = target, | ||
signal = "signal", | ||
slot = function() end, | ||
slot_params = { key = "value" }, | ||
} | ||
|
||
slot.connect(s) | ||
|
||
assert.is_true(s.connected) | ||
end) | ||
|
||
it("should disconnect slot", function() | ||
local target = new_target() | ||
|
||
local s = slot { | ||
target = target, | ||
signal = "signal", | ||
slot = function() end, | ||
slot_params = { key = "value" }, | ||
connect = true, | ||
} | ||
|
||
slot.disconnect(s) | ||
|
||
assert.is_false(s.connected) | ||
end) | ||
|
||
it("should get slot", function() | ||
local target = new_target() | ||
|
||
local s = slot { | ||
target = target, | ||
signal = "signal", | ||
slot = function() end, | ||
slot_params = { key = "value" }, | ||
} | ||
|
||
assert.is_not_nil(slot.get_slot(s)) | ||
end) | ||
|
||
it("should get slot by id", function() | ||
local target = new_target() | ||
local id = "SOME_ID" | ||
|
||
slot { | ||
id = id, | ||
target = target, | ||
signal = "signal", | ||
slot = function() end, | ||
slot_params = { key = "value" }, | ||
} | ||
|
||
assert.is_not_nil(slot.get_slot(id)) | ||
end) | ||
|
||
it("should generate id", function() | ||
local target = new_target() | ||
|
||
local s = slot { | ||
target = target, | ||
signal = "signal", | ||
slot = function() end, | ||
slot_params = { key = "value" }, | ||
} | ||
|
||
assert.is_not_nil(s.id) | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters