aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/README.md5
-rw-r--r--test/functional/api/vim_spec.lua9
-rw-r--r--test/functional/core/job_spec.lua42
-rw-r--r--test/functional/eval/ctx_functions_spec.lua8
-rw-r--r--test/functional/plugin/shada_spec.lua2
-rw-r--r--test/functional/ui/wildmode_spec.lua4
-rw-r--r--test/helpers.lua2
-rw-r--r--test/unit/viml/expressions/parser_spec.lua4
8 files changed, 40 insertions, 36 deletions
diff --git a/test/README.md b/test/README.md
index 73d51c995c..60279589b1 100644
--- a/test/README.md
+++ b/test/README.md
@@ -249,11 +249,6 @@ the file).
Configuration
=============
-busted (luassert) by default does not print the full result of deeply-nested
-tables. But sometimes it's useful while debugging a test.
-
- assert:set_parameter('TableFormatLevel', 1000000)
-
Test behaviour is affected by environment variables. Currently supported
(Functional, Unit, Benchmarks) (when Defined; when set to _1_; when defined,
treated as Integer; when defined, treated as String; when defined, treated as
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 851feddb54..07c0c5c8f3 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -922,11 +922,9 @@ describe('API', function()
},
['jumps'] = eval(([[
- filter(map(add(
- getjumplist()[0], { 'bufnr': bufnr('%'), 'lnum': getcurpos()[1] }),
- 'filter(
- { "f": expand("#".v:val.bufnr.":p"), "l": v:val.lnum },
- { k, v -> k != "l" || v != 1 })'), '!empty(v:val.f)')
+ filter(map(getjumplist()[0], 'filter(
+ { "f": expand("#".v:val.bufnr.":p"), "l": v:val.lnum },
+ { k, v -> k != "l" || v != 1 })'), '!empty(v:val.f)')
]]):gsub('\n', '')),
['buflist'] = eval([[
@@ -1568,7 +1566,6 @@ describe('API', function()
return ('%s(%s)%s'):format(typ, args, rest)
end
end
- assert:set_parameter('TableFormatLevel', 1000000)
require('test.unit.viml.expressions.parser_tests')(
it_maybe_pending, _check_parsing, hl, fmtn)
end)
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 73b0a0009d..88951e5b51 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -582,13 +582,17 @@ describe('jobs', function()
it('will run callbacks while waiting', function()
source([[
- let g:dict = {'id': 10}
- let g:exits = 0
- function g:dict.on_exit(id, code, event)
+ let g:dict = {}
+ let g:jobs = []
+ let g:exits = []
+ function g:dict.on_stdout(id, code, event) abort
+ call add(g:jobs, a:id)
+ endfunction
+ function g:dict.on_exit(id, code, event) abort
if a:code != 5
throw 'Error!'
endif
- let g:exits += 1
+ call add(g:exits, a:id)
endfunction
call jobwait(has('win32') ? [
\ jobstart('Start-Sleep -Milliseconds 100; exit 5', g:dict),
@@ -601,9 +605,10 @@ describe('jobs', function()
\ jobstart('sleep 0.050; exit 5', g:dict),
\ jobstart('sleep 0.070; exit 5', g:dict)
\ ])
- call rpcnotify(g:channel, 'wait', g:exits)
+ call rpcnotify(g:channel, 'wait', sort(g:jobs), sort(g:exits))
]])
- eq({'notification', 'wait', {4}}, next_msg())
+ eq({'notification', 'wait',
+ {{3,4,5,6}, {3,4,5,6}}}, next_msg())
end)
it('will return status codes in the order of passed ids', function()
@@ -728,15 +733,28 @@ describe('jobs', function()
end)
end)
- -- FIXME need to wait until jobsend succeeds before calling jobstop
- pending('will only emit the "exit" event after "stdout" and "stderr"', function()
- nvim('command', "let g:job_opts.on_stderr = function('s:OnEvent')")
+ pending('exit event follows stdout, stderr', function()
+ nvim('command', "let g:job_opts.on_stderr = function('OnEvent')")
nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)")
- local jobid = nvim('eval', 'j')
nvim('eval', 'jobsend(j, "abcdef")')
nvim('eval', 'jobstop(j)')
- eq({'notification', 'j', {0, {jobid, 'stdout', {'abcdef'}}}}, next_msg())
- eq({'notification', 'j', {0, {jobid, 'exit'}}}, next_msg())
+ expect_msg_seq(
+ { {'notification', 'stdout', {0, {'abcdef'}}},
+ {'notification', 'stdout', {0, {''}}},
+ {'notification', 'stderr', {0, {''}}},
+ },
+ -- Alternative sequence:
+ { {'notification', 'stderr', {0, {''}}},
+ {'notification', 'stdout', {0, {'abcdef'}}},
+ {'notification', 'stdout', {0, {''}}},
+ },
+ -- Alternative sequence:
+ { {'notification', 'stdout', {0, {'abcdef'}}},
+ {'notification', 'stderr', {0, {''}}},
+ {'notification', 'stdout', {0, {''}}},
+ }
+ )
+ eq({'notification', 'exit', {0, 143}}, next_msg())
end)
it('cannot have both rpc and pty options', function()
diff --git a/test/functional/eval/ctx_functions_spec.lua b/test/functional/eval/ctx_functions_spec.lua
index 35133e2341..742fc4893b 100644
--- a/test/functional/eval/ctx_functions_spec.lua
+++ b/test/functional/eval/ctx_functions_spec.lua
@@ -291,11 +291,9 @@ describe('context functions', function()
local with_jumps = {
['jumps'] = eval(([[
- filter(map(add(
- getjumplist()[0], { 'bufnr': bufnr('%'), 'lnum': getcurpos()[1] }),
- 'filter(
- { "f": expand("#".v:val.bufnr.":p"), "l": v:val.lnum },
- { k, v -> k != "l" || v != 1 })'), '!empty(v:val.f)')
+ filter(map(getjumplist()[0], 'filter(
+ { "f": expand("#".v:val.bufnr.":p"), "l": v:val.lnum },
+ { k, v -> k != "l" || v != 1 })'), '!empty(v:val.f)')
]]):gsub('\n', ''))
}
diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua
index c0104a58f7..d96b479a62 100644
--- a/test/functional/plugin/shada_spec.lua
+++ b/test/functional/plugin/shada_spec.lua
@@ -1360,8 +1360,6 @@ describe('autoload/shada.vim', function()
nvim_command('unlet g:__actual')
end
- assert:set_parameter('TableFormatLevel', 100)
-
it('works with multiple items', function()
strings2sd_eq({{
type=11, timestamp=0, data={
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index 738466ae2b..2215c0c7d9 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -98,8 +98,8 @@ describe("'wildmenu'", function()
]]}
-- cmdline CTRL-D display should also be preserved.
- feed([[<C-\><C-N>]])
- feed([[:sign <C-D>]]) -- Invoke cmdline CTRL-D.
+ feed([[<C-U>]])
+ feed([[sign <C-D>]]) -- Invoke cmdline CTRL-D.
expect_stay_unchanged{grid=[[
:sign |
define place |
diff --git a/test/helpers.lua b/test/helpers.lua
index 25fff55596..779d33e3b1 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -6,6 +6,8 @@ local lfs = require('lfs')
local relpath = require('pl.path').relpath
local Paths = require('test.config.paths')
+assert:set_parameter('TableFormatLevel', 100)
+
local quote_me = '[^.%w%+%-%@%_%/]' -- complement (needn't quote)
local function shell_quote(str)
if string.find(str, quote_me) or str == '' then
diff --git a/test/unit/viml/expressions/parser_spec.lua b/test/unit/viml/expressions/parser_spec.lua
index a8f29529ec..032baf6578 100644
--- a/test/unit/viml/expressions/parser_spec.lua
+++ b/test/unit/viml/expressions/parser_spec.lua
@@ -451,10 +451,6 @@ local function phl2lua(pstate)
return ret
end
-child_call_once(function()
- assert:set_parameter('TableFormatLevel', 1000000)
-end)
-
describe('Expressions parser', function()
local function _check_parsing(opts, str, exp_ast, exp_highlighting_fs,
nz_flags_exps)