diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-11 16:01:58 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-11 16:01:58 +0200 |
commit | 0f1227f7d5a3e368f61d396c1640088c079fef91 (patch) | |
tree | c7afe1e85b36fff5b513a8c465e7601364079f5d /src/testdir | |
parent | d9162550aa47ca3865a5cadf78ff2212a1d8eca7 (diff) |
patch 8.2.3144: Vim9: no error when using an invalid value for a line numberv8.2.3144
Problem: Vim9: no error when using an invalid value for a line number.
Solution: Give an error if the string value is not recognized.
(closes #8536)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 5bc51b11ca..e26c2c0dd1 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -474,7 +474,7 @@ def Test_cursor() var lines =<< trim END cursor('2', 1) END - CheckDefExecAndScriptFailure(lines, 'E475:') + CheckDefExecAndScriptFailure(lines, 'E1209:') enddef def Test_debugbreak() @@ -1036,6 +1036,25 @@ def Test_getjumplist() CheckDefFailure(['getjumplist(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string') enddef +def Test_getline() + var lines =<< trim END + new + setline(1, ['hello', 'there', 'again']) + assert_equal('hello', getline(1)) + assert_equal('hello', getline('.')) + + normal 2Gvjv + assert_equal('there', getline("'<")) + assert_equal('again', getline("'>")) + END + CheckDefAndScriptSuccess(lines) + + lines =<< trim END + echo getline('1') + END + CheckDefExecAndScriptFailure(lines, 'E1209:') +enddef + def Test_getmarklist() CheckDefFailure(['getmarklist([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>') assert_equal([], getmarklist(10000)) @@ -1049,7 +1068,7 @@ enddef def Test_getpos() CheckDefFailure(['getpos(10)'], 'E1013: Argument 1: type mismatch, expected string but got number') assert_equal([0, 1, 1, 0], getpos('.')) - assert_equal([0, 0, 0, 0], getpos('a')) + CheckDefExecFailure(['getpos("a")'], 'E1209:') enddef def Test_getqflist() |