aboutsummaryrefslogtreecommitdiff
path: root/tests/timer.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/timer.lua')
-rw-r--r--tests/timer.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/timer.lua b/tests/timer.lua
index ac8b385..80a302d 100644
--- a/tests/timer.lua
+++ b/tests/timer.lua
@@ -79,10 +79,16 @@ assert( caught[T2] )
79 79
80 80
81PRINT( "\n*** Listing timers ***\n" ) 81PRINT( "\n*** Listing timers ***\n" )
82local r = lanes.timers() -- list of {linda, key, {}} 82local r = lanes.timers() -- list of {linda, key, {when [, period]}}
83for _,t in ipairs( r) do 83for _,t in ipairs( r) do
84 local linda, key, timer = t[1], t[2], t[3] 84 local linda, key, timer_data = t[1], t[2], t[3]
85 print( tostring( linda), key, timer[1], timer[2]) 85 -- verify the structure: 3 elements, third is a nested table (not a flat 4-element entry)
86 assert(t[4] == nil, "timer entry must have exactly 3 elements, not 4 (flat structure)")
87 assert(type(linda) == "userdata", "timer entry [1] must be a linda userdata")
88 assert(type(timer_data) == "table", "timer entry [3] must be a table {when [, period]}, not a flat value")
89 assert(type(timer_data[1]) == "number", "timer_data[1] (when) must be a number")
90 assert(timer_data[2] == nil or type(timer_data[2]) == "number", "timer_data[2] (period) must be a number or nil")
91 print( tostring( linda), key, timer_data[1], timer_data[2])
86end 92end
87 93
88 94