Mercurial > vim
comparison src/testdir/test_vim9_builtin.vim @ 23786:0512923e54e1 v8.2.2434
patch 8.2.2434: Vim9: no error when compiling str2nr() with a number
Commit: https://github.com/vim/vim/commit/f2b26bcf8f498fed72759af4aa768fb2aab3118c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 30 23:05:11 2021 +0100
patch 8.2.2434: Vim9: no error when compiling str2nr() with a number
Problem: Vim9: no error when compiling str2nr() with a number.
Solution: Add argument type checks. (closes https://github.com/vim/vim/issues/7759)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 Jan 2021 23:15:06 +0100 |
parents | 9092d2a4422a |
children | d12ef361d9de |
comparison
equal
deleted
inserted
replaced
23785:186b22ebe68d | 23786:0512923e54e1 |
---|---|
865 split(' aa bb ', '\W\+', true)->assert_equal(['', 'aa', 'bb', '']) | 865 split(' aa bb ', '\W\+', true)->assert_equal(['', 'aa', 'bb', '']) |
866 enddef | 866 enddef |
867 | 867 |
868 def Test_str2nr() | 868 def Test_str2nr() |
869 str2nr("1'000'000", 10, true)->assert_equal(1000000) | 869 str2nr("1'000'000", 10, true)->assert_equal(1000000) |
870 | |
871 CheckDefFailure(['echo str2nr(123)'], 'E1013:') | |
872 CheckScriptFailure(['vim9script', 'echo str2nr(123)'], 'E1024:') | |
873 CheckDefFailure(['echo str2nr("123", "x")'], 'E1013:') | |
874 CheckScriptFailure(['vim9script', 'echo str2nr("123", "x")'], 'E1030:') | |
875 CheckDefFailure(['echo str2nr("123", 10, "x")'], 'E1013:') | |
876 CheckScriptFailure(['vim9script', 'echo str2nr("123", 10, "x")'], 'E1135:') | |
870 enddef | 877 enddef |
871 | 878 |
872 def Test_strchars() | 879 def Test_strchars() |
873 strchars("A\u20dd", true)->assert_equal(1) | 880 strchars("A\u20dd", true)->assert_equal(1) |
874 enddef | 881 enddef |