Skip to content

Commit 2d25010

Browse files
committed
test(devices): skip alias cases when absent
1 parent 1369452 commit 2d25010

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

tests/devices.test.lua

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,22 @@ describe("evdev.devices", function()
121121
assert.Equal("evdev test keyboard", dev.name)
122122
end)
123123

124-
it("finds a device by by-id alias", function()
124+
it("finds a device by by-id alias when present", function()
125125
local dev_with_alias = find_by_id(devs)
126-
assert.Table(dev_with_alias)
126+
if not dev_with_alias then
127+
pending("no discovered device with a by-id alias")
128+
end
127129

128130
local dev = find(dev_with_alias.by_id[1])
129131
assert.Table(dev) ---@cast dev -?
130132
assert.Equal(dev_with_alias.path, dev.path)
131133
end)
132134

133-
it("finds a device by by-path alias", function()
135+
it("finds a device by by-path alias when present", function()
134136
local dev_with_alias = find_by_path(devs)
135-
assert.Table(dev_with_alias)
137+
if not dev_with_alias then
138+
pending("no discovered device with a by-path alias")
139+
end
136140

137141
local dev = find(dev_with_alias.by_path[1])
138142
assert.Table(dev) ---@cast dev -?
@@ -172,7 +176,9 @@ describe("evdev.devices", function()
172176

173177
it("finds a device by by-id alias when present", function()
174178
local dev_with_alias = find_by_id(devs)
175-
assert.Table(dev_with_alias)
179+
if not dev_with_alias then
180+
pending("no discovered device with a by-id alias")
181+
end
176182

177183
local dev = find_all(dev_with_alias.by_id[1])
178184
assert.Table(dev) ---@cast dev -?
@@ -182,7 +188,9 @@ describe("evdev.devices", function()
182188

183189
it("finds a device by by-path alias when present", function()
184190
local dev_with_alias = find_by_path(devs)
185-
assert.Table(dev_with_alias)
191+
if not dev_with_alias then
192+
pending("no discovered device with a by-path alias")
193+
end
186194

187195
local dev = find_all(dev_with_alias.by_path[1])
188196
assert.Table(dev) ---@cast dev -?

0 commit comments

Comments
 (0)