Improve API of test/_client.lua

The first return value was always true. How useless...

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-11-28 21:02:27 +01:00
parent f9cdc98c73
commit 3a7e14e5d7
2 changed files with 5 additions and 10 deletions

View File

@ -96,8 +96,7 @@ return function(class, title, sn_rules, callback)
local success, msg = pipe:write_all(data)
assert(success, msg)
-- TODO: Fix the API of this function
return true, (sn_rules or callback) and snid or nil
return snid
end
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -12,7 +12,7 @@ client.connect_signal("manage", function(c)
tostring(c.machine) .. " ~= " .. tostring(awesome.hostname))
end)
local ret, snid
local snid
local num_callbacks = 0
local function callback(c)
assert(c.startup_id == snid)
@ -22,9 +22,8 @@ end
local steps = {
function(count)
if count == 1 then
ret, snid = test_client("foo", "bar", true)
snid = test_client("foo", "bar", true)
elseif manage_called then
assert(ret)
assert(snid)
assert(snid == c_snid)
return true
@ -36,10 +35,8 @@ local steps = {
function(count)
if count == 1 then
manage_called = false
ret, snid = test_client("bar", "foo", false)
test_client("bar", "foo", false)
elseif manage_called then
assert(ret)
assert(snid == nil)
assert(c_snid == nil, "c.startup_snid should be nil!")
return true
end
@ -48,9 +45,8 @@ local steps = {
function(count)
if count == 1 then
manage_called = false
ret, snid = test_client("baz", "barz", false, callback)
snid = test_client("baz", "barz", false, callback)
elseif manage_called then
assert(ret)
assert(snid)
assert(snid == c_snid)
assert(num_callbacks == 1, num_callbacks)