summaryrefslogtreecommitdiff
path: root/src/testdir/test_vimscript.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-06 21:35:05 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-06 21:35:05 +0200
commitee4e0c1e9a81cb5d96e0060203a9033c2f28588e (patch)
treeb58b410eb33044a0dadc1838e32de62ceb650e5c /src/testdir/test_vimscript.vim
parent15352dc6ec43fd50cc3be4f4fd1ad74d5619da20 (diff)
downloadvim-git-ee4e0c1e9a81cb5d96e0060203a9033c2f28588e.tar.gz
patch 8.2.0522: several errors are not tested forv8.2.0522
Problem: Several errors are not tested for. Solution: Add tests. (Yegappan Lakshmanan, closes #5892)
Diffstat (limited to 'src/testdir/test_vimscript.vim')
-rw-r--r--src/testdir/test_vimscript.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim
index 72eae7c70..9bc670270 100644
--- a/src/testdir/test_vimscript.vim
+++ b/src/testdir/test_vimscript.vim
@@ -1998,6 +1998,9 @@ func Test_missing_end()
endtry
call assert_equal(1, caught_e733)
+ " Using endfunc with :if
+ call assert_fails('exe "if 1 | endfunc | endif"', 'E193:')
+
" Missing 'in' in a :for statement
call assert_fails('for i range(1) | endfor', 'E690:')
endfunc
@@ -2044,6 +2047,15 @@ func Test_deep_nest()
@a
let @a = ''
endfunc
+
+ " Deep nesting of function ... endfunction
+ func Test5()
+ let @a = join(repeat(['function X()'], 51), "\n")
+ let @a ..= "\necho v:true\n"
+ let @a ..= join(repeat(['endfunction'], 51), "\n")
+ @a
+ let @a = ''
+ endfunc
[SCRIPT]
call writefile(lines, 'Xscript')
@@ -2051,20 +2063,31 @@ func Test_deep_nest()
" Deep nesting of if ... endif
call term_sendkeys(buf, ":call Test1()\n")
+ call term_wait(buf)
call WaitForAssert({-> assert_match('^E579:', term_getline(buf, 5))})
" Deep nesting of for ... endfor
call term_sendkeys(buf, ":call Test2()\n")
+ call term_wait(buf)
call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))})
" Deep nesting of while ... endwhile
call term_sendkeys(buf, ":call Test3()\n")
+ call term_wait(buf)
call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))})
" Deep nesting of try ... endtry
call term_sendkeys(buf, ":call Test4()\n")
+ call term_wait(buf)
call WaitForAssert({-> assert_match('^E601:', term_getline(buf, 5))})
+ " Deep nesting of function ... endfunction
+ call term_sendkeys(buf, ":call Test5()\n")
+ call term_wait(buf)
+ call WaitForAssert({-> assert_match('^E1058:', term_getline(buf, 4))})
+ call term_sendkeys(buf, "\<C-C>\n")
+ call term_wait(buf)
+
"let l = ''
"for i in range(1, 6)
" let l ..= term_getline(buf, i) . "\n"