Skip to content

Commit

Permalink
test/events: check for nil return code on error
Browse files Browse the repository at this point in the history
Problem: some event tests check that functions return != -1,
but the lua bindings return nil on error.

Change tests to check for return != nil.
  • Loading branch information
garlick committed Feb 27, 2017
1 parent aaf2d26 commit 325780f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions t/lua/t0003-events.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type_ok (f, 'userdata', "create new flux handle")
is (err, nil, "error is nil")

local rc, err = f:subscribe ("testevent.")
isnt (rc, -1, "subscribe: return code >= 0")
isnt (rc, nil, "subscribe: return code != nil")
is (err, nil, "subscribe: error is nil")

local rc, err = f:unsubscribe ("notmytopic")
Expand All @@ -24,7 +24,7 @@ is (err, "No such file or directory",
"unsubscribe: error is No such file or directory")

local rc, err = f:sendevent ({ test = "xxx" }, "testevent.1")
isnt (rc, -1, "sendevent: return code >= 0")
isnt (rc, nil, "sendevent: return code != nil")
is (err, nil, "sendevent: error is nil")

local msg, tag = f:recv_event ()
Expand All @@ -35,7 +35,7 @@ is (msg.test, "xxx", "recv_event: got payload intact")

-- sendevent takes string.format args...
local rc, err = f:sendevent ({ test = "yyy"}, "testevent.%d", 2)
isnt (rc, -1, "sendevent: return code >= 0")
isnt (rc, nil, "sendevent: return code != nil")
is (err, nil, "sendevent: error is nil")

local msg, tag = f:recv_event ()
Expand All @@ -46,7 +46,7 @@ is (msg.test, "yyy", "recv_event: got payload intact")

-- sendevent with empty payload...
local rc, err = f:sendevent ("testevent.%d", 2)
isnt (rc, -1, "sendevent: return code >= 0")
isnt (rc, nil, "sendevent: return code != nil")
is (err, nil, "sendevent: error is nil")

local msg, tag = f:recv_event ()
Expand Down

0 comments on commit 325780f

Please sign in to comment.