mirror of
https://github.com/neovim/neovim.git
synced 2026-01-04 10:26:42 +10:00
test: rename (meths, funcs) -> (api, fn)
This commit is contained in:
@@ -6,7 +6,7 @@ local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
||||
local feed_command, expect, eq, eval, source =
|
||||
helpers.feed_command, helpers.expect, helpers.eq, helpers.eval, helpers.source
|
||||
local command = helpers.command
|
||||
local meths = helpers.meths
|
||||
local api = helpers.api
|
||||
|
||||
local function basic_register_test(noblock)
|
||||
insert('some words')
|
||||
@@ -188,7 +188,7 @@ describe('clipboard', function()
|
||||
|
||||
it('valid g:clipboard', function()
|
||||
-- provider#clipboard#Executable() only checks the structure.
|
||||
meths.nvim_set_var('clipboard', {
|
||||
api.nvim_set_var('clipboard', {
|
||||
['name'] = 'clippy!',
|
||||
['copy'] = { ['+'] = 'any command', ['*'] = 'some other' },
|
||||
['paste'] = { ['+'] = 'any command', ['*'] = 'some other' },
|
||||
@@ -545,7 +545,7 @@ describe('clipboard (with fake clipboard.vim)', function()
|
||||
eq({ { 'text', '' }, 'V' }, eval("g:test_clip['*']"))
|
||||
command("let g:test_clip['*'] = [['star'], 'c']")
|
||||
feed('p')
|
||||
eq('textstar', meths.nvim_get_current_line())
|
||||
eq('textstar', api.nvim_get_current_line())
|
||||
end)
|
||||
|
||||
it('Block paste works correctly', function()
|
||||
|
||||
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
|
||||
local eval, command = helpers.eval, helpers.command
|
||||
local eq, run, stop = helpers.eq, helpers.run, helpers.stop
|
||||
local clear = helpers.clear
|
||||
local meths = helpers.meths
|
||||
local api = helpers.api
|
||||
|
||||
local function get_prefix(sync)
|
||||
if sync then
|
||||
@@ -362,7 +362,7 @@ local function function_specs_for(fn, sync, first_arg_factory, init)
|
||||
end
|
||||
|
||||
local function channel()
|
||||
return meths.nvim_get_api_info()[1]
|
||||
return api.nvim_get_api_info()[1]
|
||||
end
|
||||
|
||||
local function host()
|
||||
|
||||
@@ -5,7 +5,7 @@ local command = helpers.command
|
||||
local write_file = helpers.write_file
|
||||
local eval = helpers.eval
|
||||
local retry = helpers.retry
|
||||
local meths = helpers.meths
|
||||
local api = helpers.api
|
||||
local insert = helpers.insert
|
||||
local expect = helpers.expect
|
||||
local feed = helpers.feed
|
||||
@@ -48,7 +48,7 @@ describe('legacy perl provider', function()
|
||||
-- :perldo 1; doesn't change $_,
|
||||
-- the buffer should not be changed
|
||||
command('normal :perldo 1;')
|
||||
eq(false, meths.nvim_get_option_value('modified', {}))
|
||||
eq(false, api.nvim_get_option_value('modified', {}))
|
||||
-- insert some text
|
||||
insert('abc\ndef\nghi')
|
||||
expect([[
|
||||
|
||||
@@ -8,7 +8,7 @@ local source = helpers.source
|
||||
local missing_provider = helpers.missing_provider
|
||||
local matches = helpers.matches
|
||||
local pcall_err = helpers.pcall_err
|
||||
local funcs = helpers.funcs
|
||||
local fn = helpers.fn
|
||||
local dedent = helpers.dedent
|
||||
|
||||
do
|
||||
@@ -113,7 +113,7 @@ describe('python3 provider', function()
|
||||
|
||||
describe('py3eval()', function()
|
||||
it('works', function()
|
||||
eq({ 1, 2, { ['key'] = 'val' } }, funcs.py3eval('[1, 2, {"key": "val"}]'))
|
||||
eq({ 1, 2, { ['key'] = 'val' } }, fn.py3eval('[1, 2, {"key": "val"}]'))
|
||||
end)
|
||||
|
||||
it('errors out when given non-string', function()
|
||||
@@ -166,11 +166,11 @@ end)
|
||||
describe('python2 feature test', function()
|
||||
-- python2 is not supported, so correct behaviour is to return 0
|
||||
it('works', function()
|
||||
eq(0, funcs.has('python2'))
|
||||
eq(0, funcs.has('python'))
|
||||
eq(0, funcs.has('python_compiled'))
|
||||
eq(0, funcs.has('python_dynamic'))
|
||||
eq(0, funcs.has('python_dynamic_'))
|
||||
eq(0, funcs.has('python_'))
|
||||
eq(0, fn.has('python2'))
|
||||
eq(0, fn.has('python'))
|
||||
eq(0, fn.has('python_compiled'))
|
||||
eq(0, fn.has('python_dynamic'))
|
||||
eq(0, fn.has('python_dynamic_'))
|
||||
eq(0, fn.has('python_'))
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -8,9 +8,9 @@ local exc_exec = helpers.exc_exec
|
||||
local expect = helpers.expect
|
||||
local feed = helpers.feed
|
||||
local feed_command = helpers.feed_command
|
||||
local funcs = helpers.funcs
|
||||
local fn = helpers.fn
|
||||
local insert = helpers.insert
|
||||
local meths = helpers.meths
|
||||
local api = helpers.api
|
||||
local missing_provider = helpers.missing_provider
|
||||
local matches = helpers.matches
|
||||
local write_file = helpers.write_file
|
||||
@@ -36,19 +36,19 @@ end)
|
||||
|
||||
describe('ruby feature test', function()
|
||||
it('works', function()
|
||||
eq(1, funcs.has('ruby'))
|
||||
eq(1, fn.has('ruby'))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe(':ruby command', function()
|
||||
it('evaluates ruby', function()
|
||||
command('ruby VIM.command("let g:set_by_ruby = [100, 0]")')
|
||||
eq({ 100, 0 }, meths.nvim_get_var('set_by_ruby'))
|
||||
eq({ 100, 0 }, api.nvim_get_var('set_by_ruby'))
|
||||
end)
|
||||
|
||||
it('supports nesting', function()
|
||||
command([[ruby VIM.command('ruby VIM.command("let set_by_nested_ruby = 555")')]])
|
||||
eq(555, meths.nvim_get_var('set_by_nested_ruby'))
|
||||
eq(555, api.nvim_get_var('set_by_nested_ruby'))
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -57,7 +57,7 @@ describe(':rubyfile command', function()
|
||||
local fname = 'rubyfile.rb'
|
||||
write_file(fname, 'VIM.command("let set_by_rubyfile = 123")')
|
||||
command('rubyfile rubyfile.rb')
|
||||
eq(123, meths.nvim_get_var('set_by_rubyfile'))
|
||||
eq(123, api.nvim_get_var('set_by_rubyfile'))
|
||||
os.remove(fname)
|
||||
end)
|
||||
end)
|
||||
@@ -97,7 +97,7 @@ describe(':rubydo command', function()
|
||||
|
||||
it('does not modify the buffer if no changes are made', function()
|
||||
command('normal :rubydo 42')
|
||||
eq(false, meths.nvim_get_option_value('modified', {}))
|
||||
eq(false, api.nvim_get_option_value('modified', {}))
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -112,11 +112,11 @@ end)
|
||||
|
||||
describe('rubyeval()', function()
|
||||
it('evaluates ruby objects', function()
|
||||
eq({ 1, 2, { ['key'] = 'val' } }, funcs.rubyeval('[1, 2, {key: "val"}]'))
|
||||
eq({ 1, 2, { ['key'] = 'val' } }, fn.rubyeval('[1, 2, {key: "val"}]'))
|
||||
end)
|
||||
|
||||
it('returns nil for empty strings', function()
|
||||
eq(vim.NIL, funcs.rubyeval(''))
|
||||
eq(vim.NIL, fn.rubyeval(''))
|
||||
end)
|
||||
|
||||
it('errors out when given non-string', function()
|
||||
|
||||
Reference in New Issue
Block a user