naughty test: Use array-style spawn() calls
When a string is spawned, the C code has to split this into an array for the execve() syscall. When an array is given directly, this array does not need to be transformed in any way. This makes it much more clear what is actually started. This commit removes some quotation marks that were previously removed by the C code. For example, array:string:1,"four",2,"five",3,"six" became array:string:1,four,2,five,3,six because otherwise the action was called "four" instead of four and the test failed. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
083462e0c1
commit
a54eb67de0
|
@ -88,7 +88,7 @@ naughty.connect_signal("destroyed", destroyed_callback)
|
||||||
table.insert(steps, function()
|
table.insert(steps, function()
|
||||||
if not has_cmd_notify then return true end
|
if not has_cmd_notify then return true end
|
||||||
|
|
||||||
spawn('notify-send title message -t 25000')
|
spawn{ 'notify-send', 'title', 'message', '-t', '25000' }
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
@ -128,7 +128,7 @@ table.insert(steps, function()
|
||||||
-- There is some magic behind this, check it works
|
-- There is some magic behind this, check it works
|
||||||
assert(naughty.suspended)
|
assert(naughty.suspended)
|
||||||
|
|
||||||
spawn('notify-send title message -t 25000')
|
spawn{ 'notify-send', 'title', 'message', '-t', '25000' }
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
@ -150,7 +150,7 @@ table.insert(steps, function(count)
|
||||||
active[1]:destroy()
|
active[1]:destroy()
|
||||||
assert(#active == 0)
|
assert(#active == 0)
|
||||||
|
|
||||||
spawn('notify-send title message -t 1')
|
spawn{ 'notify-send', 'title', 'message', '-t', '1' }
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
@ -175,7 +175,7 @@ table.insert(steps, function()
|
||||||
-- There is some magic behind this, make sure it works
|
-- There is some magic behind this, make sure it works
|
||||||
assert(naughty.expiration_paused)
|
assert(naughty.expiration_paused)
|
||||||
|
|
||||||
spawn('notify-send title message -t 1')
|
spawn{ 'notify-send', 'title', 'message', '-t', '1' }
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
@ -209,9 +209,9 @@ table.insert(steps, function()
|
||||||
-- so better not "document" the instantaneous clearing of the queue.
|
-- so better not "document" the instantaneous clearing of the queue.
|
||||||
if #active > 0 then return end
|
if #active > 0 then return end
|
||||||
|
|
||||||
spawn('notify-send low message -t 25000 -u low')
|
spawn{ 'notify-send', 'low', 'message', '-t', '25000', '-u', 'low' }
|
||||||
spawn('notify-send normal message -t 25000 -u normal')
|
spawn{ 'notify-send', 'normal', 'message', '-t', '25000', '-u', 'normal' }
|
||||||
spawn('notify-send critical message -t 25000 -u critical')
|
spawn{ 'notify-send', 'critical', 'message', '-t', '25000', '-u', 'critical' }
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
@ -236,7 +236,7 @@ table.insert(steps, function()
|
||||||
-- Everything should fit, otherwise the math is wrong in
|
-- Everything should fit, otherwise the math is wrong in
|
||||||
-- `neughty.layout.legacy` and its a regression.
|
-- `neughty.layout.legacy` and its a regression.
|
||||||
for i=1, max_notif do
|
for i=1, max_notif do
|
||||||
spawn('notify-send "notif '..i..'" message -t 25000 -u low')
|
spawn{ 'notify-send', 'notif '..i, 'message', '-t', '25000', '-u', 'low' }
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -285,7 +285,7 @@ table.insert(steps, function()
|
||||||
|
|
||||||
-- Now add even more!
|
-- Now add even more!
|
||||||
for i=1, 5 do
|
for i=1, 5 do
|
||||||
spawn('notify-send "notif '..i..'" message -t 25000 -u low')
|
spawn{ 'notify-send', 'notif '..i, 'message', '-t', '25000', '-u', 'low' }
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -566,20 +566,21 @@ end)
|
||||||
-- Test more advanced features than what notify-send can provide.
|
-- Test more advanced features than what notify-send can provide.
|
||||||
if has_cmd_send then
|
if has_cmd_send then
|
||||||
|
|
||||||
local cmd = [[dbus-send \
|
local cmd = { 'dbus-send',
|
||||||
--type=method_call \
|
'--type=method_call',
|
||||||
--print-reply=literal \
|
'--print-reply=literal',
|
||||||
--dest=org.freedesktop.Notifications \
|
'--dest=org.freedesktop.Notifications',
|
||||||
/org/freedesktop/Notifications \
|
'/org/freedesktop/Notifications',
|
||||||
org.freedesktop.Notifications.Notify \
|
'org.freedesktop.Notifications.Notify',
|
||||||
string:"Awesome test" \
|
'string:"Awesome test"',
|
||||||
uint32:0 \
|
'uint32:0',
|
||||||
string:"" \
|
'string:""',
|
||||||
string:"title" \
|
'string:"title"',
|
||||||
string:"message body" \
|
'string:"message body"',
|
||||||
array:string:1,"one",2,"two",3,"three" \
|
'array:string:1,one,2,two,3,three',
|
||||||
dict:string:string:"","" \
|
'dict:string:string:"",""',
|
||||||
int32:25000]]
|
'int32:25000'
|
||||||
|
}
|
||||||
|
|
||||||
-- Test the actions.
|
-- Test the actions.
|
||||||
table.insert(steps, function()
|
table.insert(steps, function()
|
||||||
|
@ -632,20 +633,21 @@ if has_cmd_send then
|
||||||
n:connect_signal("property::message", function() message_u = true end)
|
n:connect_signal("property::message", function() message_u = true end)
|
||||||
n:connect_signal("property::actions", function() actions_u = true end)
|
n:connect_signal("property::actions", function() actions_u = true end)
|
||||||
|
|
||||||
local update = [[dbus-send \
|
local update = { 'dbus-send',
|
||||||
--type=method_call \
|
'--type=method_call',
|
||||||
--print-reply=literal \
|
'--print-reply=literal',
|
||||||
--dest=org.freedesktop.Notifications \
|
'--dest=org.freedesktop.Notifications',
|
||||||
/org/freedesktop/Notifications \
|
'/org/freedesktop/Notifications',
|
||||||
org.freedesktop.Notifications.Notify \
|
'org.freedesktop.Notifications.Notify',
|
||||||
string:"Awesome test" \
|
'string:"Awesome test"',
|
||||||
uint32:]].. nid ..[[ \
|
'uint32:' .. nid,
|
||||||
string:"" \
|
'string:""',
|
||||||
string:"updated title" \
|
'string:updated title',
|
||||||
string:"updated message body" \
|
'string:updated message body',
|
||||||
array:string:1,"four",2,"five",3,"six" \
|
'array:string:1,four,2,five,3,six',
|
||||||
dict:string:string:"","" \
|
'dict:string:string:"",""',
|
||||||
int32:25000]]
|
'int32:25000',
|
||||||
|
}
|
||||||
|
|
||||||
spawn(update)
|
spawn(update)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue