Skip to content

Commit

Permalink
Clean-up whitespace in the source and unit tests
Browse files Browse the repository at this point in the history
This patch affects nothing but whitespace.  It contains no logical
changes to any code.
  • Loading branch information
Eric James Michael Ritz committed Mar 13, 2014
1 parent 3ff9588 commit cde6597
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/Luvent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Luvent.newEvent()
--
-- @see newAction
event.actions = {}

return setmetatable(event, Luvent)
end

Expand Down Expand Up @@ -206,7 +206,7 @@ local function findAction(event, actionToFind)
return true, index
end
end

return false, nil
end

Expand Down Expand Up @@ -342,7 +342,7 @@ function Luvent:trigger(...)
end

sortActionsByPriority(self)

for _,action in ipairs(self.actions) do
if action.interval > 0 then
if os.difftime(os.time(), action.timeOfLastInvocation) >= action.interval then
Expand Down
22 changes: 11 additions & 11 deletions tests/Luvent.spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe("Basic action management", function ()
event:removeAllActions()
assert.are.equal(event:getActionCount(), 0)
end)

end)

describe("Getting information about actions", function ()
Expand All @@ -118,7 +118,7 @@ describe("Basic action management", function ()
assert.True(event:hasAction(sort))
assert.False(event:hasAction(echo))
end)

end)

describe("Disabling and re-enabling actions", function ()
Expand Down Expand Up @@ -146,10 +146,10 @@ describe("Basic action management", function ()
event:addAction(noop)
event:addAction(echo)
assert.are.equal(event:getActionCount(), 2)

event:disableAction(noop)
assert.are.equal(event:getActionCount(), 2)

event:enableAction(noop)
assert.are.equal(event:getActionCount(), 2)
end)
Expand Down Expand Up @@ -225,7 +225,7 @@ describe("Basic action management", function ()

event1:addAction(noop)
event2:addAction(noop)

event1:setActionTriggerLimit(noop, 10)

for i = 1, 10 do
Expand All @@ -245,7 +245,7 @@ describe("Triggering events", function ()

local onClickEvent
local button
local bumpCounter
local bumpCounter
local updateLabel

setup(function ()
Expand All @@ -269,7 +269,7 @@ describe("Triggering events", function ()

it("Calls actions that take no arguments", function ()
local noop = spy.new(function () end)

onClickEvent:addAction(noop)
onClickEvent:trigger()
assert.spy(noop).was.called()
Expand Down Expand Up @@ -298,7 +298,7 @@ describe("Triggering events", function ()

onClickEvent:addAction(bump)
onClickEvent:addAction(update)
onClickEvent:trigger(button)
onClickEvent:trigger(button)
onClickEvent:trigger(button)
onClickEvent:trigger(button)

Expand Down Expand Up @@ -356,7 +356,7 @@ describe("Controlling time between actions #delay", function ()
it("Calls an action only after so many seconds", function ()
local id = event:addAction(bumpTicks)
event:setActionInterval(id, 1)

while (os.time() - startTime) < 3 do
event:trigger()
end
Expand All @@ -371,7 +371,7 @@ describe("Controlling time between actions #delay", function ()
local id2 = event:addAction(bumpTicks)

event:setActionInterval(id2, 10)

assert.are.equal(event:getActionCount(), 2)

-- We trigger the event but ten seconds will not pass. So we
Expand Down Expand Up @@ -498,4 +498,4 @@ describe("Action priorities", function ()
assert.are.same(ticks, {"C", "A", "B", "C", "B", "A"})
end)

end)
end)

0 comments on commit cde6597

Please sign in to comment.