From 04f2f864e270e772c6326cefdf24947f0130e492 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 3 Jan 2024 02:09:18 +0100 Subject: refactor: format test/* --- test/functional/ex_cmds/source_spec.lua | 47 ++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'test/functional/ex_cmds/source_spec.lua') diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua index 24987354a4..e822fe78b8 100644 --- a/test/functional/ex_cmds/source_spec.lua +++ b/test/functional/ex_cmds/source_spec.lua @@ -52,13 +52,16 @@ describe(':source', function() meths.set_option_value('shellslash', false, {}) mkdir('Xshellslash') - write_file([[Xshellslash/Xstack.vim]], [[ + write_file( + [[Xshellslash/Xstack.vim]], + [[ let g:stack1 = expand('') set shellslash let g:stack2 = expand('') set noshellslash let g:stack3 = expand('') - ]]) + ]] + ) for _ = 1, 2 do command([[source Xshellslash/Xstack.vim]]) @@ -67,13 +70,16 @@ describe(':source', function() matches([[Xshellslash\Xstack%.vim]], meths.get_var('stack3')) end - write_file([[Xshellslash/Xstack.lua]], [[ + write_file( + [[Xshellslash/Xstack.lua]], + [[ vim.g.stack1 = vim.fn.expand('') vim.o.shellslash = true vim.g.stack2 = vim.fn.expand('') vim.o.shellslash = false vim.g.stack3 = vim.fn.expand('') - ]]) + ]] + ) for _ = 1, 2 do command([[source Xshellslash/Xstack.lua]]) @@ -101,11 +107,11 @@ describe(':source', function() eq("{'k': 'v'}", exec_capture('echo b')) -- Script items are created only on script var access - eq("1", exec_capture('echo c')) - eq("0zBEEFCAFE", exec_capture('echo d')) + eq('1', exec_capture('echo c')) + eq('0zBEEFCAFE', exec_capture('echo d')) exec('set cpoptions+=C') - eq('Vim(let):E723: Missing end of Dictionary \'}\': ', exc_exec('source')) + eq("Vim(let):E723: Missing end of Dictionary '}': ", exc_exec('source')) end) it('selection in current buffer', function() @@ -132,14 +138,14 @@ describe(':source', function() feed_command(':source') eq('4', exec_capture('echo a')) eq("{'K': 'V'}", exec_capture('echo b')) - eq("1_C()", exec_capture('echo D()')) + eq('1_C()', exec_capture('echo D()')) -- Source last line only feed_command(':$source') eq('Vim(echo):E117: Unknown function: s:C', exc_exec('echo D()')) exec('set cpoptions+=C') - eq('Vim(let):E723: Missing end of Dictionary \'}\': ', exc_exec("'<,'>source")) + eq("Vim(let):E723: Missing end of Dictionary '}': ", exc_exec("'<,'>source")) end) it('does not break if current buffer is modified while sourced', function() @@ -163,12 +169,15 @@ describe(':source', function() it('can source lua files', function() local test_file = 'test.lua' - write_file(test_file, [[ + write_file( + test_file, + [[ vim.g.sourced_lua = 1 vim.g.sfile_value = vim.fn.expand('') vim.g.stack_value = vim.fn.expand('') vim.g.script_value = vim.fn.expand('