diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-30 23:05:11 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-30 23:05:11 +0100 |
commit | f2b26bcf8f498fed72759af4aa768fb2aab3118c (patch) | |
tree | 3fb840f0bd9de41b463443ddf17131a0ad77f226 /src/testdir/test_vim9_builtin.vim | |
parent | b63f3ca66db20f7b135aae706d36be538f91f8cc (diff) |
patch 8.2.2434: Vim9: no error when compiling str2nr() with a numberv8.2.2434
Problem: Vim9: no error when compiling str2nr() with a number.
Solution: Add argument type checks. (closes #7759)
Diffstat (limited to 'src/testdir/test_vim9_builtin.vim')
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 776aec0bde..2929100162 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -867,6 +867,13 @@ enddef def Test_str2nr() str2nr("1'000'000", 10, true)->assert_equal(1000000) + + CheckDefFailure(['echo str2nr(123)'], 'E1013:') + CheckScriptFailure(['vim9script', 'echo str2nr(123)'], 'E1024:') + CheckDefFailure(['echo str2nr("123", "x")'], 'E1013:') + CheckScriptFailure(['vim9script', 'echo str2nr("123", "x")'], 'E1030:') + CheckDefFailure(['echo str2nr("123", 10, "x")'], 'E1013:') + CheckScriptFailure(['vim9script', 'echo str2nr("123", 10, "x")'], 'E1135:') enddef def Test_strchars() |