Skip to content

Commit

Permalink
Make serial tests a little more generic, although they still depend o…
Browse files Browse the repository at this point in the history
…n the presence of a serial port
  • Loading branch information
cmsj committed Dec 19, 2023
1 parent cf45b2d commit fe98228
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions extensions/serial/test_serial.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ function testAvailablePortPaths()
end

function testNewFromName()
local obj = hs.serial.newFromName("Bluetooth-Incoming-Port")
local obj = hs.serial.newFromName(hs.serial.availablePortNames()[1])
assertIsUserdataOfType("hs.serial", obj)
assertTrue(#tostring(obj) > 0)
return success()
end

function testNewFromPath()
local obj = hs.serial.newFromPath("/dev/cu.Bluetooth-Incoming-Port")
local obj = hs.serial.newFromPath(hs.serial.availablePortPaths()[1])
assertIsUserdataOfType("hs.serial", obj)
assertTrue(#tostring(obj) > 0)
return success()
end

function testOpenAndClose()
local obj = hs.serial.newFromPath("/dev/cu.Bluetooth-Incoming-Port")
local obj = hs.serial.newFromPath(hs.serial.availablePortPaths()[1])
assertIsUserdataOfType("hs.serial", obj)
assertTrue(#tostring(obj) > 0)

Expand All @@ -51,7 +51,7 @@ function testOpenAndClose()
end

function testAttributes()
local obj = hs.serial.newFromPath("/dev/cu.Bluetooth-Incoming-Port")
local obj = hs.serial.newFromPath(hs.serial.availablePortPaths()[1])
assertIsUserdataOfType("hs.serial", obj)
assertTrue(#tostring(obj) > 0)

Expand Down Expand Up @@ -91,4 +91,4 @@ function testAttributes()
assertTrue(obj:isOpen() == false)

return success()
end
end

0 comments on commit fe98228

Please sign in to comment.