Merge pull request #3869 from oni-link/fix.issue.3844

helpers.c: Handle msgpack str/bin objects with length 0 correctly
This commit is contained in:
Justin M. Keyes
2015-12-30 01:01:23 -05:00
2 changed files with 23 additions and 4 deletions

View File

@@ -32,6 +32,26 @@ describe('server -> client', function()
end)
end)
describe('empty string handling in arrays', function()
-- Because the msgpack encoding for an empty string was interpreted as an
-- error, msgpack arrays with an empty string looked like
-- [..., '', 0, ..., 0] after the conversion, regardless of the array
-- elements following the empty string.
it('works', function()
local function on_setup()
eq({1, 2, '', 3, 'asdf'}, eval('rpcrequest('..cid..', "nstring")'))
stop()
end
local function on_request(method, args)
-- No need to evaluate the args, we are only interested in
-- a response that contains an array with an empty string.
return {1, 2, '', 3, 'asdf'}
end
run(on_request, nil, on_setup)
end)
end)
describe('recursive call', function()
it('works', function()
local function on_setup()