diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-31 20:48:58 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-31 20:48:58 +0100 |
commit | 80ad3e25697cf759d5af5cd13e8b124c1cd657f5 (patch) | |
tree | ba7155fcb4002ce2f6c77b3244e9b2812e970157 /src/testdir/test_vim9_builtin.vim | |
parent | f272ae12ac064856b710046393d5bf9b1670076d (diff) |
patch 8.2.2443: Vim9: no compile time error for wrong str2float argumentv8.2.2443
Problem: Vim9: no compile time error for wrong str2float argument.
Solution: Check argument type. (closes #7759)
Diffstat (limited to 'src/testdir/test_vim9_builtin.vim')
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index e7bec71c8e..5fd510f579 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -916,6 +916,18 @@ def Test_split() split(' aa bb ', '\W\+', true)->assert_equal(['', 'aa', 'bb', '']) enddef +def Run_str2float() + if !has('float') + MissingFeature 'float' + endif + str2float("1.00")->assert_equal(1.00) + str2float("2e-2")->assert_equal(0.02) + + CheckDefFailure(['echo str2float(123)'], 'E1013:') + CheckScriptFailure(['vim9script', 'echo str2float(123)'], 'E1024:') + endif +enddef + def Test_str2nr() str2nr("1'000'000", 10, true)->assert_equal(1000000) |