Mercurial > vim
comparison src/testdir/vim9.vim @ 21863:809b1e7fbd72 v8.2.1481
patch 8.2.1481: Vim9: line number reported with error may be wrong
Commit: https://github.com/vim/vim/commit/3affe7a6c6fc813f5d29857933ee6aca0b9c7bd6
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 18 20:34:13 2020 +0200
patch 8.2.1481: Vim9: line number reported with error may be wrong
Problem: Vim9: line number reported with error may be wrong.
Solution: Check line number in tests.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 18 Aug 2020 20:45:03 +0200 |
parents | 3e5d0832a2e7 |
children | a211bca98bc3 |
comparison
equal
deleted
inserted
replaced
21862:961d816a163f | 21863:809b1e7fbd72 |
---|---|
8 call delete('Xdef') | 8 call delete('Xdef') |
9 endfunc | 9 endfunc |
10 | 10 |
11 " Check that "lines" inside ":def" results in an "error" message. | 11 " Check that "lines" inside ":def" results in an "error" message. |
12 " If "lnum" is given check that the error is reported for this line. | 12 " If "lnum" is given check that the error is reported for this line. |
13 func CheckDefFailure(lines, error, lnum = -1) | 13 " Add a line before and after to make it less likely that the line number is |
14 call writefile(['def Func()'] + a:lines + ['enddef', 'defcompile'], 'Xdef') | 14 " accidentally correct. |
15 call assert_fails('so Xdef', a:error, a:lines, a:lnum) | 15 func CheckDefFailure(lines, error, lnum = -3) |
16 call writefile(['def Func()', '# comment'] + a:lines + ['#comment', 'enddef', 'defcompile'], 'Xdef') | |
17 call assert_fails('so Xdef', a:error, a:lines, a:lnum + 1) | |
16 call delete('Xdef') | 18 call delete('Xdef') |
17 endfunc | 19 endfunc |
18 | 20 |
19 " Check that "lines" inside ":def" results in an "error" message when executed. | 21 " Check that "lines" inside ":def" results in an "error" message when executed. |
20 " If "lnum" is given check that the error is reported for this line. | 22 " If "lnum" is given check that the error is reported for this line. |
21 func CheckDefExecFailure(lines, error, lnum = -1) | 23 " Add a line before and after to make it less likely that the line number is |
22 call writefile(['def Func()'] + a:lines + ['enddef'], 'Xdef') | 24 " accidentally correct. |
25 func CheckDefExecFailure(lines, error, lnum = -3) | |
26 call writefile(['def Func()', '# comment'] + a:lines + ['#comment', 'enddef'], 'Xdef') | |
23 so Xdef | 27 so Xdef |
24 call assert_fails('call Func()', a:error, a:lines, a:lnum) | 28 call assert_fails('call Func()', a:error, a:lines, a:lnum + 1) |
25 call delete('Xdef') | 29 call delete('Xdef') |
26 endfunc | 30 endfunc |
27 | 31 |
28 def CheckScriptFailure(lines: list<string>, error: string) | 32 def CheckScriptFailure(lines: list<string>, error: string, lnum = -3) |
29 writefile(lines, 'Xdef') | 33 writefile(lines, 'Xdef') |
30 assert_fails('so Xdef', error, lines) | 34 assert_fails('so Xdef', error, lines, lnum) |
31 delete('Xdef') | 35 delete('Xdef') |
32 enddef | 36 enddef |
33 | 37 |
34 def CheckScriptSuccess(lines: list<string>) | 38 def CheckScriptSuccess(lines: list<string>) |
35 writefile(lines, 'Xdef') | 39 writefile(lines, 'Xdef') |