diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-01-03 02:09:18 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2024-01-03 02:09:29 +0100 |
commit | 04f2f864e270e772c6326cefdf24947f0130e492 (patch) | |
tree | 46f83f909b888a66c741032ab955afc6eab84292 /test/functional/provider/define_spec.lua | |
parent | 59d117ec99b6037cb9fad5bbfb6d0b18f5012927 (diff) | |
download | rneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.gz rneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.bz2 rneovim-04f2f864e270e772c6326cefdf24947f0130e492.zip |
refactor: format test/*
Diffstat (limited to 'test/functional/provider/define_spec.lua')
-rw-r--r-- | test/functional/provider/define_spec.lua | 87 |
1 files changed, 44 insertions, 43 deletions
diff --git a/test/functional/provider/define_spec.lua b/test/functional/provider/define_spec.lua index 12efbec326..59422d8224 100644 --- a/test/functional/provider/define_spec.lua +++ b/test/functional/provider/define_spec.lua @@ -11,7 +11,7 @@ local function get_prefix(sync) end local function call(fn, arguments) - command('call '..fn..'('..arguments..')') + command('call ' .. fn .. '(' .. arguments .. ')') end local function clear_and_init(init) @@ -44,24 +44,24 @@ end local function command_specs_for(fn, sync, first_arg_factory, init) local prefix = get_prefix(sync) - describe(prefix..' command created by', function() + describe(prefix .. ' command created by', function() before_each(clear_and_init(init)) describe(fn, function() local args before_each(function() - args = first_arg_factory()..', "test-handler", ' + args = first_arg_factory() .. ', "test-handler", ' if sync then args = args .. '1' else args = args .. '0' end - args = args..', "RpcCommand"' + args = args .. ', "RpcCommand"' end) it('without options', function() - call(fn, args..', {}') + call(fn, args .. ', {}') local function on_setup() command('RpcCommand') end @@ -75,14 +75,14 @@ local function command_specs_for(fn, sync, first_arg_factory, init) end) it('with nargs', function() - call(fn, args..', {"nargs": "*"}') + call(fn, args .. ', {"nargs": "*"}') local function on_setup() command('RpcCommand arg1 arg2 arg3') end local function handler(method, arguments) eq('test-handler', method) - eq({'arg1', 'arg2', 'arg3'}, arguments[1]) + eq({ 'arg1', 'arg2', 'arg3' }, arguments[1]) return '' end @@ -90,14 +90,14 @@ local function command_specs_for(fn, sync, first_arg_factory, init) end) it('with nargs/double-quote', function() - call(fn, args..', {"nargs": "*"}') + call(fn, args .. ', {"nargs": "*"}') local function on_setup() command('RpcCommand "arg1" "arg2" "arg3"') end local function handler(method, arguments) eq('test-handler', method) - eq({'"arg1"', '"arg2"', '"arg3"'}, arguments[1]) + eq({ '"arg1"', '"arg2"', '"arg3"' }, arguments[1]) return '' end @@ -105,14 +105,14 @@ local function command_specs_for(fn, sync, first_arg_factory, init) end) it('with range', function() - call(fn,args..', {"range": ""}') + call(fn, args .. ', {"range": ""}') local function on_setup() command('1,1RpcCommand') end local function handler(method, arguments) eq('test-handler', method) - eq({1, 1}, arguments[1]) + eq({ 1, 1 }, arguments[1]) return '' end @@ -120,15 +120,15 @@ local function command_specs_for(fn, sync, first_arg_factory, init) end) it('with nargs/range', function() - call(fn, args..', {"nargs": "1", "range": ""}') + call(fn, args .. ', {"nargs": "1", "range": ""}') local function on_setup() command('1,1RpcCommand arg') end local function handler(method, arguments) eq('test-handler', method) - eq({'arg'}, arguments[1]) - eq({1, 1}, arguments[2]) + eq({ 'arg' }, arguments[1]) + eq({ 1, 1 }, arguments[2]) return '' end @@ -136,14 +136,14 @@ local function command_specs_for(fn, sync, first_arg_factory, init) end) it('with nargs/count', function() - call(fn, args..', {"nargs": "1", "count": "5"}') + call(fn, args .. ', {"nargs": "1", "count": "5"}') local function on_setup() command('5RpcCommand arg') end local function handler(method, arguments) eq('test-handler', method) - eq({'arg'}, arguments[1]) + eq({ 'arg' }, arguments[1]) eq(5, arguments[2]) return '' end @@ -152,14 +152,14 @@ local function command_specs_for(fn, sync, first_arg_factory, init) end) it('with nargs/count/bang', function() - call(fn, args..', {"nargs": "1", "count": "5", "bang": ""}') + call(fn, args .. ', {"nargs": "1", "count": "5", "bang": ""}') local function on_setup() command('5RpcCommand! arg') end local function handler(method, arguments) eq('test-handler', method) - eq({'arg'}, arguments[1]) + eq({ 'arg' }, arguments[1]) eq(5, arguments[2]) eq(1, arguments[3]) return '' @@ -169,15 +169,14 @@ local function command_specs_for(fn, sync, first_arg_factory, init) end) it('with nargs/count/bang/register', function() - call(fn, args..', {"nargs": "1", "count": "5", "bang": "",'.. - ' "register": ""}') + call(fn, args .. ', {"nargs": "1", "count": "5", "bang": "",' .. ' "register": ""}') local function on_setup() command('5RpcCommand! b arg') end local function handler(method, arguments) eq('test-handler', method) - eq({'arg'}, arguments[1]) + eq({ 'arg' }, arguments[1]) eq(5, arguments[2]) eq(1, arguments[3]) eq('b', arguments[4]) @@ -188,8 +187,12 @@ local function command_specs_for(fn, sync, first_arg_factory, init) end) it('with nargs/count/bang/register/eval', function() - call(fn, args..', {"nargs": "1", "count": "5", "bang": "",'.. - ' "register": "", "eval": "@<reg>"}') + call( + fn, + args + .. ', {"nargs": "1", "count": "5", "bang": "",' + .. ' "register": "", "eval": "@<reg>"}' + ) local function on_setup() command('let @b = "regb"') command('5RpcCommand! b arg') @@ -197,7 +200,7 @@ local function command_specs_for(fn, sync, first_arg_factory, init) local function handler(method, arguments) eq('test-handler', method) - eq({'arg'}, arguments[1]) + eq({ 'arg' }, arguments[1]) eq(5, arguments[2]) eq(1, arguments[3]) eq('b', arguments[4]) @@ -211,28 +214,27 @@ local function command_specs_for(fn, sync, first_arg_factory, init) end) end - local function autocmd_specs_for(fn, sync, first_arg_factory, init) local prefix = get_prefix(sync) - describe(prefix..' autocmd created by', function() + describe(prefix .. ' autocmd created by', function() before_each(clear_and_init(init)) describe(fn, function() local args before_each(function() - args = first_arg_factory()..', "test-handler", ' + args = first_arg_factory() .. ', "test-handler", ' if sync then args = args .. '1' else args = args .. '0' end - args = args..', "BufEnter"' + args = args .. ', "BufEnter"' end) it('without options', function() - call(fn, args..', {}') + call(fn, args .. ', {}') local function on_setup() command('doautocmd BufEnter x.c') end @@ -246,7 +248,7 @@ local function autocmd_specs_for(fn, sync, first_arg_factory, init) end) it('with eval', function() - call(fn, args..[[, {'eval': 'expand("<afile>")'}]]) + call(fn, args .. [[, {'eval': 'expand("<afile>")'}]]) local function on_setup() command('doautocmd BufEnter x.c') end @@ -263,28 +265,27 @@ local function autocmd_specs_for(fn, sync, first_arg_factory, init) end) end - local function function_specs_for(fn, sync, first_arg_factory, init) local prefix = get_prefix(sync) - describe(prefix..' function created by', function() + describe(prefix .. ' function created by', function() before_each(clear_and_init(init)) describe(fn, function() local args before_each(function() - args = first_arg_factory()..', "test-handler", ' + args = first_arg_factory() .. ', "test-handler", ' if sync then args = args .. '1' else args = args .. '0' end - args = args..', "TestFunction"' + args = args .. ', "TestFunction"' end) it('without options', function() - call(fn, args..', {}') + call(fn, args .. ', {}') local function on_setup() if sync then eq('rv', eval('TestFunction(1, "a", ["b", "c"])')) @@ -295,7 +296,7 @@ local function function_specs_for(fn, sync, first_arg_factory, init) local function handler(method, arguments) eq('test-handler', method) - eq({{1, 'a', {'b', 'c'}}}, arguments) + eq({ { 1, 'a', { 'b', 'c' } } }, arguments) return 'rv' end @@ -303,7 +304,7 @@ local function function_specs_for(fn, sync, first_arg_factory, init) end) it('with eval', function() - call(fn, args..[[, {'eval': '2 + 2'}]]) + call(fn, args .. [[, {'eval': '2 + 2'}]]) local function on_setup() if sync then eq('rv', eval('TestFunction(1, "a", ["b", "c"])')) @@ -314,7 +315,7 @@ local function function_specs_for(fn, sync, first_arg_factory, init) local function handler(method, arguments) eq('test-handler', method) - eq({{1, 'a', {'b', 'c'}}, 4}, arguments) + eq({ { 1, 'a', { 'b', 'c' } }, 4 }, arguments) return 'rv' end @@ -327,14 +328,14 @@ local function function_specs_for(fn, sync, first_arg_factory, init) bar baz zub]]) - call(fn, args..[[, {'range': ''}]]) + call(fn, args .. [[, {'range': ''}]]) local function on_setup() command('2,3call TestFunction(1, "a", ["b", "c"])') end local function handler(method, arguments) eq('test-handler', method) - eq({{1, 'a', {'b', 'c'}}, {2, 3}}, arguments) + eq({ { 1, 'a', { 'b', 'c' } }, { 2, 3 } }, arguments) return 'rv' end @@ -342,14 +343,14 @@ local function function_specs_for(fn, sync, first_arg_factory, init) end) it('with eval/range', function() - call(fn, args..[[, {'eval': '4', 'range': ''}]]) + call(fn, args .. [[, {'eval': '4', 'range': ''}]]) local function on_setup() command('%call TestFunction(1, "a", ["b", "c"])') end local function handler(method, arguments) eq('test-handler', method) - eq({{1, 'a', {'b', 'c'}}, {1, 1}, 4}, arguments) + eq({ { 1, 'a', { 'b', 'c' } }, { 1, 1 }, 4 }, arguments) return 'rv' end @@ -368,7 +369,7 @@ local function host() end local function register() - eval('remote#host#Register("busted", "busted", '..channel()..')') + eval('remote#host#Register("busted", "busted", ' .. channel() .. ')') end command_specs_for('remote#define#CommandOnChannel', true, channel) |