mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-03 17:24:29 +00:00 
			
		
		
		
	test: Eliminate plugin/helpers.lua
This commit is contained in:
		@@ -1,6 +1,5 @@
 | 
			
		||||
local helpers = require('test.functional.helpers')(after_each)
 | 
			
		||||
local Screen = require('test.functional.ui.screen')
 | 
			
		||||
local plugin_helpers = require('test.functional.plugin.helpers')
 | 
			
		||||
 | 
			
		||||
local clear = helpers.clear
 | 
			
		||||
local curbuf_contents = helpers.curbuf_contents
 | 
			
		||||
@@ -41,7 +40,7 @@ end)
 | 
			
		||||
 | 
			
		||||
describe('health.vim', function()
 | 
			
		||||
  before_each(function()
 | 
			
		||||
    plugin_helpers.reset()
 | 
			
		||||
    clear{args={'-u', 'NORC'}}
 | 
			
		||||
    -- Provides functions:
 | 
			
		||||
    --    health#broken#check()
 | 
			
		||||
    --    health#success1#check()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,41 +0,0 @@
 | 
			
		||||
local paths = require('test.config.paths')
 | 
			
		||||
 | 
			
		||||
local helpers = require('test.functional.helpers')(nil)
 | 
			
		||||
local spawn, set_session, nvim_prog, merge_args =
 | 
			
		||||
  helpers.spawn, helpers.set_session, helpers.nvim_prog, helpers.merge_args
 | 
			
		||||
 | 
			
		||||
local additional_cmd = ''
 | 
			
		||||
 | 
			
		||||
local function nvim_argv(shada_file)
 | 
			
		||||
  local rtp_value = ('\'%s/runtime\''):format(
 | 
			
		||||
      paths.test_source_path:gsub('\'', '\'\''))
 | 
			
		||||
  local nvim_args = {nvim_prog, '-u', 'NORC', '-i', shada_file or 'NONE', '-N',
 | 
			
		||||
                     '--cmd', 'set shortmess+=I background=light noswapfile belloff= noshowcmd noruler',
 | 
			
		||||
                     '--cmd', 'let &runtimepath=' .. rtp_value,
 | 
			
		||||
                     '--cmd', additional_cmd,
 | 
			
		||||
                     '--embed', '--headless'}
 | 
			
		||||
  if helpers.prepend_argv then
 | 
			
		||||
    return merge_args(helpers.prepend_argv, nvim_args)
 | 
			
		||||
  else
 | 
			
		||||
    return nvim_args
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local session = nil
 | 
			
		||||
 | 
			
		||||
local function reset(...)
 | 
			
		||||
  if session then
 | 
			
		||||
    session:close()
 | 
			
		||||
  end
 | 
			
		||||
  session = spawn(nvim_argv(...))
 | 
			
		||||
  set_session(session)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local function set_additional_cmd(s)
 | 
			
		||||
  additional_cmd = s
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
return {
 | 
			
		||||
  reset=reset,
 | 
			
		||||
  set_additional_cmd=set_additional_cmd,
 | 
			
		||||
}
 | 
			
		||||
@@ -1,19 +1,17 @@
 | 
			
		||||
local helpers = require('test.functional.helpers')(after_each)
 | 
			
		||||
local plugin_helpers = require('test.functional.plugin.helpers')
 | 
			
		||||
local Screen = require('test.functional.ui.screen')
 | 
			
		||||
 | 
			
		||||
local clear = helpers.clear
 | 
			
		||||
local command = helpers.command
 | 
			
		||||
local meths = helpers.meths
 | 
			
		||||
local feed = helpers.feed
 | 
			
		||||
local eq = helpers.eq
 | 
			
		||||
 | 
			
		||||
local reset = plugin_helpers.reset
 | 
			
		||||
 | 
			
		||||
describe('matchparen', function()
 | 
			
		||||
  local screen
 | 
			
		||||
 | 
			
		||||
  before_each(function()
 | 
			
		||||
    reset()
 | 
			
		||||
    clear{args={'-u', 'NORC'}}
 | 
			
		||||
    screen = Screen.new(20,5)
 | 
			
		||||
    screen:attach()
 | 
			
		||||
    screen:set_default_attr_ids( {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,15 @@
 | 
			
		||||
local helpers = require('test.functional.helpers')(after_each)
 | 
			
		||||
local clear = helpers.clear
 | 
			
		||||
local meths = helpers.meths
 | 
			
		||||
local eq, nvim_eval, nvim_command, exc_exec =
 | 
			
		||||
  helpers.eq, helpers.eval, helpers.command, helpers.exc_exec
 | 
			
		||||
local ok = helpers.ok
 | 
			
		||||
local NIL = helpers.NIL
 | 
			
		||||
 | 
			
		||||
local plugin_helpers = require('test.functional.plugin.helpers')
 | 
			
		||||
local reset = plugin_helpers.reset
 | 
			
		||||
 | 
			
		||||
describe('autoload/msgpack.vim', function()
 | 
			
		||||
  before_each(reset)
 | 
			
		||||
  before_each(function()
 | 
			
		||||
    clear{args={'-u', 'NORC'}}
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  local sp = function(typ, val)
 | 
			
		||||
    return ('{"_TYPE": v:msgpack_types.%s, "_VAL": %s}'):format(typ, val)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,6 @@
 | 
			
		||||
local paths = require('test.config.paths')
 | 
			
		||||
local helpers = require('test.functional.helpers')(after_each)
 | 
			
		||||
local clear = helpers.clear
 | 
			
		||||
local eq, nvim_eval, nvim_command, nvim, exc_exec, funcs, nvim_feed, curbuf =
 | 
			
		||||
  helpers.eq, helpers.eval, helpers.command, helpers.nvim, helpers.exc_exec,
 | 
			
		||||
  helpers.funcs, helpers.feed, helpers.curbuf
 | 
			
		||||
@@ -7,12 +9,21 @@ local read_file = helpers.read_file
 | 
			
		||||
 | 
			
		||||
local mpack = require('mpack')
 | 
			
		||||
 | 
			
		||||
local plugin_helpers = require('test.functional.plugin.helpers')
 | 
			
		||||
local reset = plugin_helpers.reset
 | 
			
		||||
 | 
			
		||||
local shada_helpers = require('test.functional.shada.helpers')
 | 
			
		||||
local get_shada_rw = shada_helpers.get_shada_rw
 | 
			
		||||
 | 
			
		||||
local function reset(shada_file)
 | 
			
		||||
  -- TODO(justinmk): why is this needed?
 | 
			
		||||
  local rtp_value = ('\'%s/runtime\''):format(
 | 
			
		||||
      paths.test_source_path:gsub('\'', '\'\''))
 | 
			
		||||
  clear{args_rm={'-u', '-i'},
 | 
			
		||||
        args={'-u', 'NORC',
 | 
			
		||||
              '-i', shada_file or 'NONE',
 | 
			
		||||
              '--cmd', 'set laststatus&',
 | 
			
		||||
              '--cmd', 'let &runtimepath='..rtp_value,
 | 
			
		||||
        }}
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local mpack_eq = function(expected, mpack_result)
 | 
			
		||||
  local mpack_keys = {'type', 'timestamp', 'length', 'value'}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user