Mercurial > vim
comparison src/testdir/test_functions.vim @ 30310:029c59bf78f1 v9.0.0491
patch 9.0.0491: no good reason to build without the float feature
Commit: https://github.com/vim/vim/commit/73e28dcc6125f616cf1f2d56443d22428a79e434
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 17 21:08:33 2022 +0100
patch 9.0.0491: no good reason to build without the float feature
Problem: No good reason to build without the float feature.
Solution: Remove configure check for float and "#ifdef FEAT_FLOAT".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 17 Sep 2022 22:15:05 +0200 |
parents | b6b803ed4a53 |
children | a7a9e8b9af89 |
comparison
equal
deleted
inserted
replaced
30309:4ba3d27b5357 | 30310:029c59bf78f1 |
---|---|
52 call assert_equal(1, empty(0)) | 52 call assert_equal(1, empty(0)) |
53 call assert_equal(1, empty(-0)) | 53 call assert_equal(1, empty(-0)) |
54 call assert_equal(0, empty(1)) | 54 call assert_equal(0, empty(1)) |
55 call assert_equal(0, empty(-1)) | 55 call assert_equal(0, empty(-1)) |
56 | 56 |
57 if has('float') | 57 call assert_equal(1, empty(0.0)) |
58 call assert_equal(1, empty(0.0)) | 58 call assert_equal(1, empty(-0.0)) |
59 call assert_equal(1, empty(-0.0)) | 59 call assert_equal(0, empty(1.0)) |
60 call assert_equal(0, empty(1.0)) | 60 call assert_equal(0, empty(-1.0)) |
61 call assert_equal(0, empty(-1.0)) | 61 call assert_equal(0, empty(1.0/0.0)) |
62 call assert_equal(0, empty(1.0/0.0)) | 62 call assert_equal(0, empty(0.0/0.0)) |
63 call assert_equal(0, empty(0.0/0.0)) | |
64 endif | |
65 | 63 |
66 call assert_equal(1, empty([])) | 64 call assert_equal(1, empty([])) |
67 call assert_equal(0, empty(['a'])) | 65 call assert_equal(0, empty(['a'])) |
68 | 66 |
69 call assert_equal(1, empty({})) | 67 call assert_equal(1, empty({})) |
88 call assert_fails("call empty(test_unknown())", 'E685:') | 86 call assert_fails("call empty(test_unknown())", 'E685:') |
89 endfunc | 87 endfunc |
90 | 88 |
91 func Test_test_void() | 89 func Test_test_void() |
92 call assert_fails('echo 1 == test_void()', 'E1031:') | 90 call assert_fails('echo 1 == test_void()', 'E1031:') |
93 if has('float') | 91 call assert_fails('echo 1.0 == test_void()', 'E1031:') |
94 call assert_fails('echo 1.0 == test_void()', 'E1031:') | |
95 endif | |
96 call assert_fails('let x = json_encode(test_void())', 'E685:') | 92 call assert_fails('let x = json_encode(test_void())', 'E685:') |
97 call assert_fails('let x = copy(test_void())', 'E685:') | 93 call assert_fails('let x = copy(test_void())', 'E685:') |
98 call assert_fails('let x = copy([test_void()])', 'E1031:') | 94 call assert_fails('let x = copy([test_void()])', 'E1031:') |
99 endfunc | 95 endfunc |
100 | 96 |
173 call assert_fails('call strwidth({->0})', 'E729:') | 169 call assert_fails('call strwidth({->0})', 'E729:') |
174 call assert_fails('call strwidth([])', 'E730:') | 170 call assert_fails('call strwidth([])', 'E730:') |
175 call assert_fails('call strwidth({})', 'E731:') | 171 call assert_fails('call strwidth({})', 'E731:') |
176 endfor | 172 endfor |
177 | 173 |
178 if has('float') | 174 call assert_equal(3, strwidth(1.2)) |
179 call assert_equal(3, strwidth(1.2)) | 175 call v9.CheckDefAndScriptFailure(['echo strwidth(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) |
180 call v9.CheckDefAndScriptFailure(['echo strwidth(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) | |
181 endif | |
182 | 176 |
183 set ambiwidth& | 177 set ambiwidth& |
184 endfunc | 178 endfunc |
185 | 179 |
186 func Test_str2nr() | 180 func Test_str2nr() |
240 call assert_equal(0, str2nr(v:null)) | 234 call assert_equal(0, str2nr(v:null)) |
241 call assert_equal(0, str2nr(v:none)) | 235 call assert_equal(0, str2nr(v:none)) |
242 | 236 |
243 call assert_fails('call str2nr([])', 'E730:') | 237 call assert_fails('call str2nr([])', 'E730:') |
244 call assert_fails('call str2nr({->2})', 'E729:') | 238 call assert_fails('call str2nr({->2})', 'E729:') |
245 if has('float') | 239 call assert_equal(1, str2nr(1.2)) |
246 call assert_equal(1, str2nr(1.2)) | 240 call v9.CheckDefAndScriptFailure(['echo str2nr(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) |
247 call v9.CheckDefAndScriptFailure(['echo str2nr(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) | |
248 endif | |
249 call assert_fails('call str2nr(10, [])', 'E745:') | 241 call assert_fails('call str2nr(10, [])', 'E745:') |
250 endfunc | 242 endfunc |
251 | 243 |
252 func Test_strftime() | 244 func Test_strftime() |
253 CheckFunction strftime | 245 CheckFunction strftime |
502 call delete('Xsimpdir', 'd') | 494 call delete('Xsimpdir', 'd') |
503 | 495 |
504 call assert_fails('call simplify({->0})', 'E729:') | 496 call assert_fails('call simplify({->0})', 'E729:') |
505 call assert_fails('call simplify([])', 'E730:') | 497 call assert_fails('call simplify([])', 'E730:') |
506 call assert_fails('call simplify({})', 'E731:') | 498 call assert_fails('call simplify({})', 'E731:') |
507 if has('float') | 499 call assert_equal('1.2', simplify(1.2)) |
508 call assert_equal('1.2', simplify(1.2)) | 500 call v9.CheckDefAndScriptFailure(['echo simplify(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) |
509 call v9.CheckDefAndScriptFailure(['echo simplify(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) | |
510 endif | |
511 endfunc | 501 endfunc |
512 | 502 |
513 func Test_pathshorten() | 503 func Test_pathshorten() |
514 call assert_equal('', pathshorten('')) | 504 call assert_equal('', pathshorten('')) |
515 call assert_equal('foo', pathshorten('foo')) | 505 call assert_equal('foo', pathshorten('foo')) |