From e72ecdb7ca1face1d16e622824aa7bd3c98f5673 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 16 Feb 2018 19:42:05 +0100 Subject: test/util: expect_msg_seq() job_spec.lua on AppVeyor (Windows) often fails like this: FAILED ] C:/projects/neovim/test/functional\core\job_spec.lua @ 72: jobs changes to given `cwd` directory C:/projects/neovim/test/functional\core\job_spec.lua:81: Expected objects to be the same. Passed in: (table) { [1] = 'notification' [2] = 'stdout' *[3] = { [1] = 0 *[2] = { [1] = 'C:\projects\neovim\Xtest-tmpdir\nvimmSjq1S\0' } } } Expected: (table) { [1] = 'notification' [2] = 'stdout' *[3] = { [1] = 0 *[2] = { [1] = 'C:\projects\neovim\Xtest-tmpdir\nvimmSjq1S\0' *[2] = '' } } } stack traceback: Message chunking is non-deterministic, so we need to try different variants. --- test/functional/core/job_spec.lua | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'test/functional/core') diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index a02d36c939..73d437169a 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -12,6 +12,7 @@ local get_pathsep = helpers.get_pathsep local pathroot = helpers.pathroot local nvim_set = helpers.nvim_set local expect_twostreams = helpers.expect_twostreams +local expect_msg_seq = helpers.expect_msg_seq local Screen = require('test.functional.ui.screen') describe('jobs', function() @@ -78,9 +79,18 @@ describe('jobs', function() else nvim('command', "let j = jobstart('pwd', g:job_opts)") end - eq({'notification', 'stdout', {0, {dir, ''}}}, next_msg()) - eq({'notification', 'stdout', {0, {''}}}, next_msg()) - eq({'notification', 'exit', {0, 0}}, next_msg()) + expect_msg_seq( + { {'notification', 'stdout', {0, {dir, ''} } }, + {'notification', 'stdout', {0, {''} } }, + {'notification', 'exit', {0, 0} } + }, + -- Alternative sequence: + { {'notification', 'stdout', {0, {dir} } }, + {'notification', 'stdout', {0, {'', ''} } }, + {'notification', 'stdout', {0, {''} } }, + {'notification', 'exit', {0, 0} } + } + ) rmdir(dir) end) @@ -308,8 +318,15 @@ describe('jobs', function() nvim('command', 'unlet g:job_opts.on_exit') nvim('command', 'let g:job_opts.user = 5') nvim('command', [[call jobstart('echo "foo"', g:job_opts)]]) - eq({'notification', 'stdout', {5, {'foo', ''}}}, next_msg()) - eq({'notification', 'stdout', {5, {''}}}, next_msg()) + expect_msg_seq( + { {'notification', 'stdout', {5, {'foo', ''} } }, + {'notification', 'stdout', {5, {''} } } + }, + -- Alternative sequence: + { {'notification', 'stdout', {5, {'foo'} } }, + {'notification', 'stdout', {5, {'', ''} } } + } + ) end) it('will pass return code with the exit event', function() -- cgit