Mercurial > vim
comparison src/testdir/test_vimscript.vim @ 19932:2c4d9ca33769 v8.2.0522
patch 8.2.0522: several errors are not tested for
Commit: https://github.com/vim/vim/commit/ee4e0c1e9a81cb5d96e0060203a9033c2f28588e
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 6 21:35:05 2020 +0200
patch 8.2.0522: several errors are not tested for
Problem: Several errors are not tested for.
Solution: Add tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5892)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 06 Apr 2020 21:45:31 +0200 |
parents | b3e93a05c3ca |
children | 9cbe3a4f1492 |
comparison
equal
deleted
inserted
replaced
19931:db6b095f4073 | 19932:2c4d9ca33769 |
---|---|
1996 catch /E733:/ | 1996 catch /E733:/ |
1997 let caught_e733 = 1 | 1997 let caught_e733 = 1 |
1998 endtry | 1998 endtry |
1999 call assert_equal(1, caught_e733) | 1999 call assert_equal(1, caught_e733) |
2000 | 2000 |
2001 " Using endfunc with :if | |
2002 call assert_fails('exe "if 1 | endfunc | endif"', 'E193:') | |
2003 | |
2001 " Missing 'in' in a :for statement | 2004 " Missing 'in' in a :for statement |
2002 call assert_fails('for i range(1) | endfor', 'E690:') | 2005 call assert_fails('for i range(1) | endfor', 'E690:') |
2003 endfunc | 2006 endfunc |
2004 | 2007 |
2005 " Test for deep nesting of if/for/while/try statements {{{1 | 2008 " Test for deep nesting of if/for/while/try statements {{{1 |
2042 let @a ..= "\necho v:true\n" | 2045 let @a ..= "\necho v:true\n" |
2043 let @a ..= join(repeat(['endtry'], 51), "\n") | 2046 let @a ..= join(repeat(['endtry'], 51), "\n") |
2044 @a | 2047 @a |
2045 let @a = '' | 2048 let @a = '' |
2046 endfunc | 2049 endfunc |
2050 | |
2051 " Deep nesting of function ... endfunction | |
2052 func Test5() | |
2053 let @a = join(repeat(['function X()'], 51), "\n") | |
2054 let @a ..= "\necho v:true\n" | |
2055 let @a ..= join(repeat(['endfunction'], 51), "\n") | |
2056 @a | |
2057 let @a = '' | |
2058 endfunc | |
2047 [SCRIPT] | 2059 [SCRIPT] |
2048 call writefile(lines, 'Xscript') | 2060 call writefile(lines, 'Xscript') |
2049 | 2061 |
2050 let buf = RunVimInTerminal('-S Xscript', {'rows': 6}) | 2062 let buf = RunVimInTerminal('-S Xscript', {'rows': 6}) |
2051 | 2063 |
2052 " Deep nesting of if ... endif | 2064 " Deep nesting of if ... endif |
2053 call term_sendkeys(buf, ":call Test1()\n") | 2065 call term_sendkeys(buf, ":call Test1()\n") |
2066 call term_wait(buf) | |
2054 call WaitForAssert({-> assert_match('^E579:', term_getline(buf, 5))}) | 2067 call WaitForAssert({-> assert_match('^E579:', term_getline(buf, 5))}) |
2055 | 2068 |
2056 " Deep nesting of for ... endfor | 2069 " Deep nesting of for ... endfor |
2057 call term_sendkeys(buf, ":call Test2()\n") | 2070 call term_sendkeys(buf, ":call Test2()\n") |
2071 call term_wait(buf) | |
2058 call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))}) | 2072 call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))}) |
2059 | 2073 |
2060 " Deep nesting of while ... endwhile | 2074 " Deep nesting of while ... endwhile |
2061 call term_sendkeys(buf, ":call Test3()\n") | 2075 call term_sendkeys(buf, ":call Test3()\n") |
2076 call term_wait(buf) | |
2062 call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))}) | 2077 call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))}) |
2063 | 2078 |
2064 " Deep nesting of try ... endtry | 2079 " Deep nesting of try ... endtry |
2065 call term_sendkeys(buf, ":call Test4()\n") | 2080 call term_sendkeys(buf, ":call Test4()\n") |
2081 call term_wait(buf) | |
2066 call WaitForAssert({-> assert_match('^E601:', term_getline(buf, 5))}) | 2082 call WaitForAssert({-> assert_match('^E601:', term_getline(buf, 5))}) |
2083 | |
2084 " Deep nesting of function ... endfunction | |
2085 call term_sendkeys(buf, ":call Test5()\n") | |
2086 call term_wait(buf) | |
2087 call WaitForAssert({-> assert_match('^E1058:', term_getline(buf, 4))}) | |
2088 call term_sendkeys(buf, "\<C-C>\n") | |
2089 call term_wait(buf) | |
2067 | 2090 |
2068 "let l = '' | 2091 "let l = '' |
2069 "for i in range(1, 6) | 2092 "for i in range(1, 6) |
2070 " let l ..= term_getline(buf, i) . "\n" | 2093 " let l ..= term_getline(buf, i) . "\n" |
2071 "endfor | 2094 "endfor |