test(oldtest): uncomment method call syntax uses

We should now be equal with Vim in regards to method call support of already ported built-ins.

Enable all relevant commented-out uses of the syntax in tests that I could grep.
This commit is contained in:
Sean Dewar
2021-11-01 23:24:49 +00:00
parent 752ca2cb9f
commit 6e3e8c51c0
10 changed files with 21 additions and 39 deletions

View File

@@ -526,8 +526,7 @@ func Test_autocmd_blast_badd()
call writefile(content, 'XblastBall')
call system(GetVimCommand() .. ' --clean -S XblastBall')
" call assert_match('OK', readfile('Xerrors')->join())
call assert_match('OK', join(readfile('Xerrors')))
call assert_match('OK', readfile('Xerrors')->join())
call delete('XblastBall')
call delete('Xerrors')

View File

@@ -38,10 +38,9 @@ func Test_compiler()
endfunc
func GetCompilerNames()
" return glob('$VIMRUNTIME/compiler/*.vim', 0, 1)
" \ ->map({i, v -> substitute(v, '.*[\\/]\([a-zA-Z0-9_\-]*\).vim', '\1', '')})
" \ ->sort()
return sort(map(glob('$VIMRUNTIME/compiler/*.vim', 0, 1), {i, v -> substitute(v, '.*[\\/]\([a-zA-Z0-9_\-]*\).vim', '\1', '')}))
return glob('$VIMRUNTIME/compiler/*.vim', 0, 1)
\ ->map({i, v -> substitute(v, '.*[\\/]\([a-zA-Z0-9_\-]*\).vim', '\1', '')})
\ ->sort()
endfunc
func Test_compiler_without_arg()
@@ -54,8 +53,7 @@ func Test_compiler_without_arg()
endfunc
func Test_compiler_completion()
" let clist = GetCompilerNames()->join(' ')
let clist = join(GetCompilerNames(), ' ')
let clist = GetCompilerNames()->join(' ')
call feedkeys(":compiler \<C-A>\<C-B>\"\<CR>", 'tx')
call assert_match('^"compiler ' .. clist .. '$', @:)

View File

@@ -809,8 +809,7 @@ func Test_undo_fold_deletion()
g/"/d
undo
redo
" eval getline(1, '$')->assert_equal([''])
eval assert_equal(getline(1, '$'), [''])
eval getline(1, '$')->assert_equal([''])
set fdm&vim
bwipe!

View File

@@ -156,8 +156,7 @@ func Test_mksession_zero_winheight()
wincmd _
mksession! Xtest_mks_zero
set winminheight&
" let text = readfile('Xtest_mks_zero')->join()
let text = join(readfile('Xtest_mks_zero'))
let text = readfile('Xtest_mks_zero')->join()
call delete('Xtest_mks_zero')
close
" check there is no divide by zero

View File

@@ -235,8 +235,7 @@ func Test_set_completion()
call feedkeys(":set filetype=sshdconfi\<Tab>\<C-B>\"\<CR>", 'xt')
call assert_equal('"set filetype=sshdconfig', @:)
call feedkeys(":set filetype=a\<C-A>\<C-B>\"\<CR>", 'xt')
" call assert_equal('"set filetype=' .. getcompletion('a*', 'filetype')->join(), @:)
call assert_equal('"set filetype=' .. join(getcompletion('a*', 'filetype')), @:)
call assert_equal('"set filetype=' .. getcompletion('a*', 'filetype')->join(), @:)
endfunc
func Test_set_errors()

View File

@@ -512,8 +512,7 @@ func TestGoodBadBase()
break
endif
let prevbad = bad
" let lst = bad->spellsuggest(3)
let lst = spellsuggest(bad, 3)
let lst = bad->spellsuggest(3)
normal mm
call add(result, [bad, lst])
@@ -552,8 +551,7 @@ func Test_spell_basic()
\ )
call assert_equal("gebletegek", soundfold('goobledygoook'))
" call assert_equal("kepereneven", 'kóopërÿnôven'->soundfold())
call assert_equal("kepereneven", soundfold('kóopërÿnôven'))
call assert_equal("kepereneven", 'kóopërÿnôven'->soundfold())
call assert_equal("everles gesvets etele", soundfold('oeverloos gezwets edale'))
endfunc

View File

@@ -905,15 +905,13 @@ func Test_not_a_term()
" This will take 2 seconds because of the missing --not-a-term
let cmd = GetVimProg() .. ' --cmd quit ' .. redir
exe "silent !" . cmd
" call assert_match("\<Esc>", readfile('Xvimout')->join())
call assert_match("\<Esc>", join(readfile('Xvimout')))
call assert_match("\<Esc>", readfile('Xvimout')->join())
call delete('Xvimout')
" With --not-a-term there are no escape sequences.
let cmd = GetVimProg() .. ' --not-a-term --cmd quit ' .. redir
exe "silent !" . cmd
" call assert_notmatch("\<Esc>", readfile('Xvimout')->join())
call assert_notmatch("\<Esc>", join(readfile('Xvimout')))
call assert_notmatch("\<Esc>", readfile('Xvimout')->join())
call delete('Xvimout')
endfunc

View File

@@ -752,8 +752,7 @@ endfunc
func Test_submatch_list_concatenate()
let pat = 'A\(.\)'
let Rep = {-> string([submatch(0, 1)] + [[submatch(1)]])}
" call substitute('A1', pat, Rep, '')->assert_equal("[['A1'], ['1']]")
call assert_equal(substitute('A1', pat, Rep, ''), "[['A1'], ['1']]")
call substitute('A1', pat, Rep, '')->assert_equal("[['A1'], ['1']]")
endfunc
func Test_substitute_skipped_range()

View File

@@ -30,23 +30,17 @@ func AssertHighlightGroups(lnum, startcol, expected, trans = 1, msg = "")
" If groups are provided as a string, each character is assumed to be a
" group and spaces represent no group, useful for visually describing tests.
let l:expectedGroups = type(a:expected) == v:t_string
"\ ? a:expected->split('\zs')->map({_, v -> trim(v)})
\ ? map(split(a:expected, '\zs'), {_, v -> trim(v)})
\ ? a:expected->split('\zs')->map({_, v -> trim(v)})
\ : a:expected
let l:errors = 0
" let l:msg = (a:msg->empty() ? "" : a:msg .. ": ")
let l:msg = (empty(a:msg) ? "" : a:msg .. ": ")
let l:msg = (a:msg->empty() ? "" : a:msg .. ": ")
\ .. "Wrong highlight group at " .. a:lnum .. ","
" for l:i in range(a:startcol, a:startcol + l:expectedGroups->len() - 1)
" let l:errors += synID(a:lnum, l:i, a:trans)
" \ ->synIDattr("name")
" \ ->assert_equal(l:expectedGroups[l:i - 1],
for l:i in range(a:startcol, a:startcol + len(l:expectedGroups) - 1)
let l:errors +=
\ assert_equal(synIDattr(synID(a:lnum, l:i, a:trans), "name"),
\ l:expectedGroups[l:i - 1],
\ l:msg .. l:i)
for l:i in range(a:startcol, a:startcol + l:expectedGroups->len() - 1)
let l:errors += synID(a:lnum, l:i, a:trans)
\ ->synIDattr("name")
\ ->assert_equal(l:expectedGroups[l:i - 1],
\ l:msg .. l:i)
endfor
endfunc

View File

@@ -121,8 +121,7 @@ func Test_system_with_shell_quote()
let msg = printf('shell=%s shellxquote=%s', &shell, &shellxquote)
try
" let out = 'echo 123'->system()
let out = system('echo 123')
let out = 'echo 123'->system()
catch
call assert_report(printf('%s: %s', msg, v:exception))
continue