view src/testdir/vim9.vim @ 20261:aafedd368f40 v8.2.0686

patch 8.2.0686: formatoptions not sufficiently tested Commit: https://github.com/vim/vim/commit/2eaeaf3c317a5145fb0bc926411561d50883019b Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 3 16:04:43 2020 +0200 patch 8.2.0686: formatoptions not sufficiently tested Problem: Formatoptions not sufficiently tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6031)
author Bram Moolenaar <Bram@vim.org>
date Sun, 03 May 2020 16:15:03 +0200
parents 0612c64a2b87
children ce1b73835822
line wrap: on
line source

" Utility functions for testing vim9 script

" Check that "lines" inside ":def" results in an "error" message.
func CheckDefFailure(lines, error)
  call writefile(['def Func()'] + a:lines + ['enddef'], 'Xdef')
  call assert_fails('so Xdef', a:error, a:lines)
  call delete('Xdef')
endfunc

def CheckScriptFailure(lines: list<string>, error: string)
  writefile(lines, 'Xdef')
  assert_fails('so Xdef', error, lines)
  delete('Xdef')
enddef

def CheckScriptSuccess(lines: list<string>)
  writefile(lines, 'Xdef')
  so Xdef
  delete('Xdef')
enddef

" Check that "line" inside ":def" results in an "error" message when executed.
func CheckDefExecFailure(line, error)
  call writefile(['def! Func()', a:line, 'enddef'], 'Xdef')
  so Xdef
  call assert_fails('call Func()', a:error, a:line)
  call delete('Xdef')
endfunc