Mercurial > vim
comparison src/testdir/test_functions.vim @ 24822:5f8dd7b3ae41 v8.2.2949
patch 8.2.2949: tests failing because no error for float to string conversion
Commit: https://github.com/vim/vim/commit/3cfa5b16b06bcc034f6de77070fa779d698ab5e9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 6 14:14:39 2021 +0200
patch 8.2.2949: tests failing because no error for float to string conversion
Problem: Tests failing because there is no error for float to string
conversion.
Solution: Change the check for failure to check for correct result. Make
some conversions strict in Vim9 script.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 06 Jun 2021 14:15:04 +0200 |
parents | 29ed95687f74 |
children | 3f9053c21765 |
comparison
equal
deleted
inserted
replaced
24821:0218caefb9b8 | 24822:5f8dd7b3ae41 |
---|---|
163 call assert_equal((aw == 'single') ? 6 : 7, strwidth('Straße')) | 163 call assert_equal((aw == 'single') ? 6 : 7, strwidth('Straße')) |
164 | 164 |
165 call assert_fails('call strwidth({->0})', 'E729:') | 165 call assert_fails('call strwidth({->0})', 'E729:') |
166 call assert_fails('call strwidth([])', 'E730:') | 166 call assert_fails('call strwidth([])', 'E730:') |
167 call assert_fails('call strwidth({})', 'E731:') | 167 call assert_fails('call strwidth({})', 'E731:') |
168 if has('float') | |
169 call assert_fails('call strwidth(1.2)', 'E806:') | |
170 endif | |
171 endfor | 168 endfor |
169 | |
170 if has('float') | |
171 call assert_equal(3, strwidth(1.2)) | |
172 call CheckDefExecAndScriptFailure(['echo strwidth(1.2)'], 'E806:') | |
173 endif | |
172 | 174 |
173 set ambiwidth& | 175 set ambiwidth& |
174 endfunc | 176 endfunc |
175 | 177 |
176 func Test_str2nr() | 178 func Test_str2nr() |
231 call assert_equal(0, str2nr(v:none)) | 233 call assert_equal(0, str2nr(v:none)) |
232 | 234 |
233 call assert_fails('call str2nr([])', 'E730:') | 235 call assert_fails('call str2nr([])', 'E730:') |
234 call assert_fails('call str2nr({->2})', 'E729:') | 236 call assert_fails('call str2nr({->2})', 'E729:') |
235 if has('float') | 237 if has('float') |
236 call assert_fails('call str2nr(1.2)', 'E806:') | 238 call assert_equal(1, str2nr(1.2)) |
239 call CheckDefExecFailure(['echo str2nr(1.2)'], 'E1013:') | |
240 call CheckScriptFailure(['vim9script', 'echo str2nr(1.2)'], 'E806:') | |
237 endif | 241 endif |
238 call assert_fails('call str2nr(10, [])', 'E745:') | 242 call assert_fails('call str2nr(10, [])', 'E745:') |
239 endfunc | 243 endfunc |
240 | 244 |
241 func Test_strftime() | 245 func Test_strftime() |
492 | 496 |
493 call assert_fails('call simplify({->0})', 'E729:') | 497 call assert_fails('call simplify({->0})', 'E729:') |
494 call assert_fails('call simplify([])', 'E730:') | 498 call assert_fails('call simplify([])', 'E730:') |
495 call assert_fails('call simplify({})', 'E731:') | 499 call assert_fails('call simplify({})', 'E731:') |
496 if has('float') | 500 if has('float') |
497 call assert_fails('call simplify(1.2)', 'E806:') | 501 call assert_equal('1.2', simplify(1.2)) |
502 call CheckDefExecAndScriptFailure(['echo simplify(1.2)'], 'E806:') | |
498 endif | 503 endif |
499 endfunc | 504 endfunc |
500 | 505 |
501 func Test_pathshorten() | 506 func Test_pathshorten() |
502 call assert_equal('', pathshorten('')) | 507 call assert_equal('', pathshorten('')) |