File: test-client-swap.lua

package info (click to toggle)
awesome 4.3-8.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,468 kB
  • sloc: ansic: 14,508; sh: 526; makefile: 46
file content (33 lines) | stat: -rw-r--r-- 1,029 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
-- Test if client's c:swap() corrupts the Lua stack

local runner = require("_runner")
local test_client = require("_client")

runner.run_steps({
                 -- Spawn two clients
                 function(count)
                     if count == 1 then
                         test_client()
                         test_client()
                     end
                     if #client.get() >= 2 then
                         return true
                     end
                 end,

                 -- Swap them
                 function()
                     assert(#client.get() == 2, #client.get())
                     local c1 = client.get()[1]
                     local c2 = client.get()[2]

                     c2:swap(c1)
                     c1:swap(c2)
                     c1:swap(c2)
                     c1:swap(c2)
                     c2:swap(c1)
                     return true
                 end,
             })

-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80