refactor: format test/*

This commit is contained in:
Justin M. Keyes
2024-01-03 02:09:18 +01:00
parent 59d117ec99
commit 04f2f864e2
363 changed files with 30631 additions and 20833 deletions

View File

@@ -11,13 +11,13 @@ local setenv = helpers.funcs.setenv
describe('environment variables', function()
it('environ() handles empty env variable', function()
clear({env={EMPTY_VAR=""}})
eq("", environ()['EMPTY_VAR'])
clear({ env = { EMPTY_VAR = '' } })
eq('', environ()['EMPTY_VAR'])
eq(nil, environ()['DOES_NOT_EXIST'])
end)
it('exists() handles empty env variable', function()
clear({env={EMPTY_VAR=""}})
clear({ env = { EMPTY_VAR = '' } })
eq(1, exists('$EMPTY_VAR'))
eq(0, exists('$DOES_NOT_EXIST'))
end)
@@ -46,23 +46,32 @@ describe('empty $HOME', function()
end
local function write_and_test_tilde()
system({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--headless',
'-c', 'write test_empty_home', '+q'})
system({
nvim_prog,
'-u',
'NONE',
'-i',
'NONE',
'--headless',
'-c',
'write test_empty_home',
'+q',
})
eq(false, tilde_in_cwd())
end
it("'~' folder not created in cwd if $HOME and related env not defined", function()
command("unlet $HOME")
command('unlet $HOME')
write_and_test_tilde()
command("let $HOMEDRIVE='C:'")
command("let $USERPROFILE='C:\\'")
write_and_test_tilde()
command("unlet $HOMEDRIVE")
command('unlet $HOMEDRIVE')
write_and_test_tilde()
command("unlet $USERPROFILE")
command('unlet $USERPROFILE')
write_and_test_tilde()
command("let $HOME='%USERPROFILE%'")