2016-10-29 09:34:45 +02:00
|
|
|
-- Test if client's c:swap() corrupts the Lua stack
|
|
|
|
|
|
|
|
local runner = require("_runner")
|
|
|
|
local test_client = require("_client")
|
|
|
|
|
|
|
|
runner.run_steps({
|
2016-12-27 21:39:08 +01:00
|
|
|
-- Spawn two clients
|
|
|
|
function(count)
|
|
|
|
if count == 1 then
|
|
|
|
test_client()
|
|
|
|
test_client()
|
|
|
|
end
|
|
|
|
if #client.get() >= 2 then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end,
|
2016-10-29 09:34:45 +02:00
|
|
|
|
2016-12-27 21:39:08 +01:00
|
|
|
-- Swap them
|
|
|
|
function()
|
|
|
|
assert(#client.get() == 2, #client.get())
|
|
|
|
local c1 = client.get()[1]
|
|
|
|
local c2 = client.get()[2]
|
2016-10-29 09:34:45 +02:00
|
|
|
|
2016-12-27 21:39:08 +01:00
|
|
|
c2:swap(c1)
|
|
|
|
c1:swap(c2)
|
|
|
|
c1:swap(c2)
|
|
|
|
c1:swap(c2)
|
|
|
|
c2:swap(c1)
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
})
|
2016-10-29 09:34:45 +02:00
|
|
|
|
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|