Skip to content

Commit a836734

Browse files
committed
Fix. Test for Lua > 5.1
1 parent e7f83e7 commit a836734

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/test_multi_callback.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ local curl = require "lcurl"
22

33
local called, active_coroutine = 0
44

5+
-- for Lua 5.1 compat
6+
local function co_running()
7+
local co, main = coroutine.running()
8+
if main == true then return nil end
9+
return co
10+
end
11+
512
function on_timer()
613
called = called + 1
714
-- use `os.exit` because now Lua-cURL did not propogate error from callback
8-
if coroutine.running() ~= active_coroutine then os.exit(-1) end
15+
if co_running() ~= active_coroutine then os.exit(-1) end
916
end
1017

1118
local function test_1()

0 commit comments

Comments
 (0)