comparison src/testdir/test_python3.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 13b02c1ea0f7
children 457ea0570b6f
comparison
equal deleted inserted replaced
30309:4ba3d27b5357 30310:029c59bf78f1
284 endfunc 284 endfunc
285 285
286 " Test vim.eval() with various types. 286 " Test vim.eval() with various types.
287 func Test_python3_vim_val() 287 func Test_python3_vim_val()
288 call assert_equal("\n8", execute('py3 print(vim.eval("3+5"))')) 288 call assert_equal("\n8", execute('py3 print(vim.eval("3+5"))'))
289 if has('float') 289 call assert_equal("\n3.140000", execute('py3 print(vim.eval("1.01+2.13"))'))
290 call assert_equal("\n3.140000", execute('py3 print(vim.eval("1.01+2.13"))')) 290 call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))'))
291 call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))')) 291 call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))'))
292 call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))')) 292 call assert_equal("\n-0.000000", execute('py3 print(vim.eval("0.0/(-1.0/0.0)"))'))
293 call assert_equal("\n-0.000000", execute('py3 print(vim.eval("0.0/(-1.0/0.0)"))')) 293 " Commented out: output of infinity and nan depend on platforms.
294 " Commented out: output of infinity and nan depend on platforms. 294 " call assert_equal("\ninf", execute('py3 print(vim.eval("1.0/0.0"))'))
295 " call assert_equal("\ninf", execute('py3 print(vim.eval("1.0/0.0"))')) 295 " call assert_equal("\n-inf", execute('py3 print(vim.eval("-1.0/0.0"))'))
296 " call assert_equal("\n-inf", execute('py3 print(vim.eval("-1.0/0.0"))')) 296 " call assert_equal("\n-nan", execute('py3 print(vim.eval("0.0/0.0"))'))
297 " call assert_equal("\n-nan", execute('py3 print(vim.eval("0.0/0.0"))'))
298 endif
299 call assert_equal("\nabc", execute('py3 print(vim.eval("\"abc\""))')) 297 call assert_equal("\nabc", execute('py3 print(vim.eval("\"abc\""))'))
300 call assert_equal("\n['1', '2']", execute('py3 print(vim.eval("[1, 2]"))')) 298 call assert_equal("\n['1', '2']", execute('py3 print(vim.eval("[1, 2]"))'))
301 call assert_equal("\n{'1': '2'}", execute('py3 print(vim.eval("{1:2}"))')) 299 call assert_equal("\n{'1': '2'}", execute('py3 print(vim.eval("{1:2}"))'))
302 call assert_equal("\nTrue", execute('py3 print(vim.eval("v:true"))')) 300 call assert_equal("\nTrue", execute('py3 print(vim.eval("v:true"))'))
303 call assert_equal("\nFalse", execute('py3 print(vim.eval("v:false"))')) 301 call assert_equal("\nFalse", execute('py3 print(vim.eval("v:false"))'))
877 close! 875 close!
878 delfunction DictNew 876 delfunction DictNew
879 endfunc 877 endfunc
880 878
881 func Test_python3_float() 879 func Test_python3_float()
882 CheckFeature float
883 let l = [0.0] 880 let l = [0.0]
884 py3 l = vim.bindeval('l') 881 py3 l = vim.bindeval('l')
885 py3 l.extend([0.0]) 882 py3 l.extend([0.0])
886 call assert_equal([0.0, 0.0], l) 883 call assert_equal([0.0, 0.0], l)
887 endfunc 884 endfunc
980 call assert_equal('', v:errmsg) 977 call assert_equal('', v:errmsg)
981 978
982 py3 v = vim.eval('test_null_function()') 979 py3 v = vim.eval('test_null_function()')
983 call assert_equal(v:none, py3eval('v')) 980 call assert_equal(v:none, py3eval('v'))
984 981
985 if has('float') 982 call assert_equal(0.0, py3eval('0.0'))
986 call assert_equal(0.0, py3eval('0.0'))
987 endif
988 983
989 " Evaluate an invalid values 984 " Evaluate an invalid values
990 call AssertException(['let v = py3eval(''"\0"'')'], 'E859:') 985 call AssertException(['let v = py3eval(''"\0"'')'], 'E859:')
991 call AssertException(['let v = py3eval(''{"\0" : 1}'')'], 'E859:') 986 call AssertException(['let v = py3eval(''{"\0" : 1}'')'], 'E859:')
992 call AssertException(['let v = py3eval("undefined_name")'], 987 call AssertException(['let v = py3eval("undefined_name")'],