summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/runtest.vim4
-rw-r--r--src/testdir/test_assert.vim28
-rw-r--r--src/testdir/test_blob.vim4
-rw-r--r--src/testdir/test_cscope.vim36
-rw-r--r--src/testdir/test_eval_stuff.vim18
-rw-r--r--src/testdir/test_execute_func.vim8
-rw-r--r--src/testdir/test_expr.vim244
-rw-r--r--src/testdir/test_float_func.vim1
-rw-r--r--src/testdir/test_functions.vim36
-rw-r--r--src/testdir/test_glob2regpat.vim6
-rw-r--r--src/testdir/test_json.vim56
-rw-r--r--src/testdir/test_listdict.vim34
-rw-r--r--src/testdir/test_lua.vim1
-rw-r--r--src/testdir/test_messages.vim8
-rw-r--r--src/testdir/test_method.vim1
-rw-r--r--src/testdir/test_perl.vim6
-rw-r--r--src/testdir/test_python2.vim5
-rw-r--r--src/testdir/test_python3.vim23
-rw-r--r--src/testdir/test_random.vim4
-rw-r--r--src/testdir/test_reltime.vim1
-rw-r--r--src/testdir/test_ruby.vim6
-rw-r--r--src/testdir/test_sort.vim57
-rw-r--r--src/testdir/test_substitute.vim2
-rw-r--r--src/testdir/test_terminal.vim4
-rw-r--r--src/testdir/test_true_false.vim5
-rw-r--r--src/testdir/test_user_func.vim8
-rw-r--r--src/testdir/test_vim9_assign.vim58
-rw-r--r--src/testdir/test_vim9_builtin.vim26
-rw-r--r--src/testdir/test_vim9_disassemble.vim74
-rw-r--r--src/testdir/test_vim9_expr.vim342
-rw-r--r--src/testdir/test_vimscript.vim152
31 files changed, 526 insertions, 732 deletions
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim
index 68c3dd3ef..1946282f8 100644
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -283,11 +283,11 @@ func RunTheTest(test)
if has('reltime')
let message ..= repeat(' ', 50 - len(message))
let time = reltime(func_start)
- if has('float') && reltimefloat(time) > 0.1
+ if reltimefloat(time) > 0.1
let message = s:t_bold .. message
endif
let message ..= ' in ' .. reltimestr(time) .. ' seconds'
- if has('float') && reltimefloat(time) > 0.1
+ if reltimefloat(time) > 0.1
let message ..= s:t_normal
endif
endif
diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim
index 5d4abaa8a..b666c011e 100644
--- a/src/testdir/test_assert.vim
+++ b/src/testdir/test_assert.vim
@@ -352,21 +352,19 @@ func Test_assert_inrange()
call assert_fails('call assert_inrange(1, 1)', 'E119:')
- if has('float')
- call assert_equal(0, assert_inrange(7.0, 7, 7))
- call assert_equal(0, assert_inrange(7, 7.0, 7))
- call assert_equal(0, assert_inrange(7, 7, 7.0))
- call assert_equal(0, assert_inrange(5, 7, 5.0))
- call assert_equal(0, assert_inrange(5, 7, 6.0))
- call assert_equal(0, assert_inrange(5, 7, 7.0))
-
- call assert_equal(1, assert_inrange(5, 7, 4.0))
- call assert_match("Expected range 5.0 - 7.0, but got 4.0", v:errors[0])
- call remove(v:errors, 0)
- call assert_equal(1, assert_inrange(5, 7, 8.0))
- call assert_match("Expected range 5.0 - 7.0, but got 8.0", v:errors[0])
- call remove(v:errors, 0)
- endif
+ call assert_equal(0, assert_inrange(7.0, 7, 7))
+ call assert_equal(0, assert_inrange(7, 7.0, 7))
+ call assert_equal(0, assert_inrange(7, 7, 7.0))
+ call assert_equal(0, assert_inrange(5, 7, 5.0))
+ call assert_equal(0, assert_inrange(5, 7, 6.0))
+ call assert_equal(0, assert_inrange(5, 7, 7.0))
+
+ call assert_equal(1, assert_inrange(5, 7, 4.0))
+ call assert_match("Expected range 5.0 - 7.0, but got 4.0", v:errors[0])
+ call remove(v:errors, 0)
+ call assert_equal(1, assert_inrange(5, 7, 8.0))
+ call assert_match("Expected range 5.0 - 7.0, but got 8.0", v:errors[0])
+ call remove(v:errors, 0)
endfunc
func Test_assert_with_msg()
diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim
index b0239fd61..ce8c3d09f 100644
--- a/src/testdir/test_blob.vim
+++ b/src/testdir/test_blob.vim
@@ -669,9 +669,7 @@ func Test_blob_lock()
endfunc
func Test_blob_sort()
- if has('float')
- call v9.CheckLegacyAndVim9Failure(['call sort([1.0, 0z11], "f")'], 'E975:')
- endif
+ call v9.CheckLegacyAndVim9Failure(['call sort([1.0, 0z11], "f")'], 'E975:')
call v9.CheckLegacyAndVim9Failure(['call sort([11, 0z11], "N")'], 'E974:')
endfunc
diff --git a/src/testdir/test_cscope.vim b/src/testdir/test_cscope.vim
index d70103ca2..d29949c4e 100644
--- a/src/testdir/test_cscope.vim
+++ b/src/testdir/test_cscope.vim
@@ -122,25 +122,23 @@ func Test_cscopeWithCscopeConnections()
call assert_fails('cs find', 'E560:')
call assert_fails('cs find x', 'E560:')
- if has('float')
- " Test: Find places where this symbol is assigned a value
- " this needs a cscope >= 15.8
- " unfortunately, Travis has cscope version 15.7
- let cscope_version = systemlist('cscope --version')[0]
- let cs_version = str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?'))
- if cs_version >= 15.8
- for cmd in ['cs find a item', 'cs find 9 item']
- let a = execute(cmd)
- call assert_equal(['', '(1 of 4): <<test_mf_hash>> item = LALLOC_CLEAR_ONE(mf_hashitem_T);'], split(a, '\n', 1))
- call assert_equal(' item = LALLOC_CLEAR_ONE(mf_hashitem_T);', getline('.'))
- cnext
- call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
- cnext
- call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
- cnext
- call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
- endfor
- endif
+ " Test: Find places where this symbol is assigned a value
+ " this needs a cscope >= 15.8
+ " unfortunately, Travis has cscope version 15.7
+ let cscope_version = systemlist('cscope --version')[0]
+ let cs_version = str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?'))
+ if cs_version >= 15.8
+ for cmd in ['cs find a item', 'cs find 9 item']
+ let a = execute(cmd)
+ call assert_equal(['', '(1 of 4): <<test_mf_hash>> item = LALLOC_CLEAR_ONE(mf_hashitem_T);'], split(a, '\n', 1))
+ call assert_equal(' item = LALLOC_CLEAR_ONE(mf_hashitem_T);', getline('.'))
+ cnext
+ call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
+ cnext
+ call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
+ cnext
+ call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
+ endfor
endif
" Test: leading whitespace is not removed for cscope find text
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index 7d8421b72..33ab45fcd 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -240,11 +240,9 @@ func Test_string_concatenation()
let a..=b
call assert_equal('ab', a)
- if has('float')
- let a = 'A'
- let b = 1.234
- call assert_equal('A1.234', a .. b)
- endif
+ let a = 'A'
+ let b = 1.234
+ call assert_equal('A1.234', a .. b)
endfunc
" Test fix for issue #4507
@@ -266,10 +264,8 @@ func Test_string_concat_scriptversion2()
call assert_fails('let a .= b', 'E985:')
call assert_fails('let vers = 1.2.3', 'E488:')
- if has('float')
- let f = .5
- call assert_equal(0.5, f)
- endif
+ let f = .5
+ call assert_equal(0.5, f)
endfunc
scriptversion 1
@@ -283,9 +279,7 @@ func Test_string_concat_scriptversion1()
let vers = 1.2.3
call assert_equal('123', vers)
- if has('float')
- call assert_fails('let f = .5', 'E15:')
- endif
+ call assert_fails('let f = .5', 'E15:')
endfunc
scriptversion 3
diff --git a/src/testdir/test_execute_func.vim b/src/testdir/test_execute_func.vim
index 3a8580e98..b25f211f8 100644
--- a/src/testdir/test_execute_func.vim
+++ b/src/testdir/test_execute_func.vim
@@ -38,11 +38,9 @@ func Test_execute_string()
call assert_equal("\nsomething", execute('echo "something"', 'silent'))
call assert_equal("\nsomething", execute('echo "something"', 'silent!'))
call assert_equal("", execute('burp', 'silent!'))
- if has('float')
- call assert_fails('call execute(3.4)', 'E492:')
- call assert_equal("\nx", execute("echo \"x\"", 3.4))
- call v9.CheckDefExecAndScriptFailure(['execute("echo \"x\"", 3.4)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1174:'])
- endif
+ call assert_fails('call execute(3.4)', 'E492:')
+ call assert_equal("\nx", execute("echo \"x\"", 3.4))
+ call v9.CheckDefExecAndScriptFailure(['execute("echo \"x\"", 3.4)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1174:'])
endfunc
func Test_execute_list()
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim
index 3cd2a0d0d..8e2345d7f 100644
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -77,9 +77,7 @@ func Test_op_falsy()
call assert_equal(0z00, 0z00 ?? 456)
call assert_equal([1], [1] ?? 456)
call assert_equal({'one': 1}, {'one': 1} ?? 456)
- if has('float')
- call assert_equal(0.1, 0.1 ?? 456)
- endif
+ call assert_equal(0.1, 0.1 ?? 456)
call assert_equal(456, v:false ?? 456)
call assert_equal(456, 0 ?? 456)
@@ -87,9 +85,7 @@ func Test_op_falsy()
call assert_equal(456, 0z ?? 456)
call assert_equal(456, [] ?? 456)
call assert_equal(456, {} ?? 456)
- if has('float')
- call assert_equal(456, 0.0 ?? 456)
- endif
+ call assert_equal(456, 0.0 ?? 456)
END
call v9.CheckLegacyAndVim9Success(lines)
endfunc
@@ -200,10 +196,8 @@ func Test_compare_with_null()
call assert_false(s:value == v:null)
let s:value = 0
call assert_true(s:value == v:null)
- if has('float')
- let s:value = 0.0
- call assert_true(s:value == v:null)
- endif
+ let s:value = 0.0
+ call assert_true(s:value == v:null)
let s:value = ''
call assert_false(s:value == v:null)
let s:value = 0z
@@ -467,116 +461,114 @@ func Test_printf_misc()
endfunc
func Test_printf_float()
- if has('float')
- let lines =<< trim END
- call assert_equal('1.000000', printf('%f', 1))
- call assert_equal('1.230000', printf('%f', 1.23))
- call assert_equal('1.230000', printf('%F', 1.23))
- call assert_equal('9999999.9', printf('%g', 9999999.9))
- call assert_equal('9999999.9', printf('%G', 9999999.9))
- call assert_equal('1.00000001e7', printf('%.8g', 10000000.1))
- call assert_equal('1.00000001E7', printf('%.8G', 10000000.1))
- call assert_equal('1.230000e+00', printf('%e', 1.23))
- call assert_equal('1.230000E+00', printf('%E', 1.23))
- call assert_equal('1.200000e-02', printf('%e', 0.012))
- call assert_equal('-1.200000e-02', printf('%e', -0.012))
- call assert_equal('0.33', printf('%.2f', 1.0 / 3.0))
- call assert_equal(' 0.33', printf('%6.2f', 1.0 / 3.0))
- call assert_equal(' -0.33', printf('%6.2f', -1.0 / 3.0))
- call assert_equal('000.33', printf('%06.2f', 1.0 / 3.0))
- call assert_equal('-00.33', printf('%06.2f', -1.0 / 3.0))
- call assert_equal('-00.33', printf('%+06.2f', -1.0 / 3.0))
- call assert_equal('+00.33', printf('%+06.2f', 1.0 / 3.0))
- call assert_equal(' 00.33', printf('% 06.2f', 1.0 / 3.0))
- call assert_equal('000.33', printf('%06.2g', 1.0 / 3.0))
- call assert_equal('-00.33', printf('%06.2g', -1.0 / 3.0))
- call assert_equal('0.33', printf('%3.2f', 1.0 / 3.0))
- call assert_equal('003.33e-01', printf('%010.2e', 1.0 / 3.0))
- call assert_equal(' 03.33e-01', printf('% 010.2e', 1.0 / 3.0))
- call assert_equal('+03.33e-01', printf('%+010.2e', 1.0 / 3.0))
- call assert_equal('-03.33e-01', printf('%010.2e', -1.0 / 3.0))
-
- #" When precision is 0, the dot should be omitted.
- call assert_equal(' 2', printf('%3.f', 7.0 / 3.0))
- call assert_equal(' 2', printf('%3.g', 7.0 / 3.0))
- call assert_equal(' 2e+00', printf('%7.e', 7.0 / 3.0))
-
- #" Float zero can be signed.
- call assert_equal('+0.000000', printf('%+f', 0.0))
- call assert_equal('0.000000', printf('%f', 1.0 / (1.0 / 0.0)))
- call assert_equal('-0.000000', printf('%f', 1.0 / (-1.0 / 0.0)))
- call assert_equal('0.0', printf('%s', 1.0 / (1.0 / 0.0)))
- call assert_equal('-0.0', printf('%s', 1.0 / (-1.0 / 0.0)))
- call assert_equal('0.0', printf('%S', 1.0 / (1.0 / 0.0)))
- call assert_equal('-0.0', printf('%S', 1.0 / (-1.0 / 0.0)))
-
- #" Float infinity can be signed.
- call assert_equal('inf', printf('%f', 1.0 / 0.0))
- call assert_equal('-inf', printf('%f', -1.0 / 0.0))
- call assert_equal('inf', printf('%g', 1.0 / 0.0))
- call assert_equal('-inf', printf('%g', -1.0 / 0.0))
- call assert_equal('inf', printf('%e', 1.0 / 0.0))
- call assert_equal('-inf', printf('%e', -1.0 / 0.0))
- call assert_equal('INF', printf('%F', 1.0 / 0.0))
- call assert_equal('-INF', printf('%F', -1.0 / 0.0))
- call assert_equal('INF', printf('%E', 1.0 / 0.0))
- call assert_equal('-INF', printf('%E', -1.0 / 0.0))
- call assert_equal('INF', printf('%E', 1.0 / 0.0))
- call assert_equal('-INF', printf('%G', -1.0 / 0.0))
- call assert_equal('+inf', printf('%+f', 1.0 / 0.0))
- call assert_equal('-inf', printf('%+f', -1.0 / 0.0))
- call assert_equal(' inf', printf('% f', 1.0 / 0.0))
- call assert_equal(' inf', printf('%6f', 1.0 / 0.0))
- call assert_equal(' -inf', printf('%6f', -1.0 / 0.0))
- call assert_equal(' inf', printf('%6g', 1.0 / 0.0))
- call assert_equal(' -inf', printf('%6g', -1.0 / 0.0))
- call assert_equal(' +inf', printf('%+6f', 1.0 / 0.0))
- call assert_equal(' inf', printf('% 6f', 1.0 / 0.0))
- call assert_equal(' +inf', printf('%+06f', 1.0 / 0.0))
- call assert_equal('inf ', printf('%-6f', 1.0 / 0.0))
- call assert_equal('-inf ', printf('%-6f', -1.0 / 0.0))
- call assert_equal('+inf ', printf('%-+6f', 1.0 / 0.0))
- call assert_equal(' inf ', printf('%- 6f', 1.0 / 0.0))
- call assert_equal('-INF ', printf('%-6F', -1.0 / 0.0))
- call assert_equal('+INF ', printf('%-+6F', 1.0 / 0.0))
- call assert_equal(' INF ', printf('%- 6F', 1.0 / 0.0))
- call assert_equal('INF ', printf('%-6G', 1.0 / 0.0))
- call assert_equal('-INF ', printf('%-6G', -1.0 / 0.0))
- call assert_equal('INF ', printf('%-6E', 1.0 / 0.0))
- call assert_equal('-INF ', printf('%-6E', -1.0 / 0.0))
- call assert_equal('inf', printf('%s', 1.0 / 0.0))
- call assert_equal('-inf', printf('%s', -1.0 / 0.0))
-
- #" Test special case where max precision is truncated at 340.
- call assert_equal('1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.330f', 1.0))
- call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.340f', 1.0))
- call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.350f', 1.0))
-
- #" Float nan (not a number) has no sign.
- call assert_equal('nan', printf('%f', sqrt(-1.0)))
- call assert_equal('nan', printf('%f', 0.0 / 0.0))
- call assert_equal('nan', printf('%f', -0.0 / 0.0))
- call assert_equal('nan', printf('%g', 0.0 / 0.0))
- call assert_equal('nan', printf('%e', 0.0 / 0.0))
- call assert_equal('NAN', printf('%F', 0.0 / 0.0))
- call assert_equal('NAN', printf('%G', 0.0 / 0.0))
- call assert_equal('NAN', printf('%E', 0.0 / 0.0))
- call assert_equal('NAN', printf('%F', -0.0 / 0.0))
- call assert_equal('NAN', printf('%G', -0.0 / 0.0))
- call assert_equal('NAN', printf('%E', -0.0 / 0.0))
- call assert_equal(' nan', printf('%6f', 0.0 / 0.0))
- call assert_equal(' nan', printf('%06f', 0.0 / 0.0))
- call assert_equal('nan ', printf('%-6f', 0.0 / 0.0))
- call assert_equal('nan ', printf('%- 6f', 0.0 / 0.0))
- call assert_equal('nan', printf('%s', 0.0 / 0.0))
- call assert_equal('nan', printf('%s', -0.0 / 0.0))
- call assert_equal('nan', printf('%S', 0.0 / 0.0))
- call assert_equal('nan', printf('%S', -0.0 / 0.0))
- END
- call v9.CheckLegacyAndVim9Success(lines)
-
- call v9.CheckLegacyAndVim9Failure(['echo printf("%f", "a")'], 'E807:')
- endif
+ let lines =<< trim END
+ call assert_equal('1.000000', printf('%f', 1))
+ call assert_equal('1.230000', printf('%f', 1.23))
+ call assert_equal('1.230000', printf('%F', 1.23))
+ call assert_equal('9999999.9', printf('%g', 9999999.9))
+ call assert_equal('9999999.9', printf('%G', 9999999.9))
+ call assert_equal('1.00000001e7', printf('%.8g', 10000000.1))
+ call assert_equal('1.00000001E7', printf('%.8G', 10000000.1))
+ call assert_equal('1.230000e+00', printf('%e', 1.23))
+ call assert_equal('1.230000E+00', printf('%E', 1.23))
+ call assert_equal('1.200000e-02', printf('%e', 0.012))
+ call assert_equal('-1.200000e-02', printf('%e', -0.012))
+ call assert_equal('0.33', printf('%.2f', 1.0 / 3.0))
+ call assert_equal(' 0.33', printf('%6.2f', 1.0 / 3.0))
+ call assert_equal(' -0.33', printf('%6.2f', -1.0 / 3.0))
+ call assert_equal('000.33', printf('%06.2f', 1.0 / 3.0))
+ call assert_equal('-00.33', printf('%06.2f', -1.0 / 3.0))
+ call assert_equal('-00.33', printf('%+06.2f', -1.0 / 3.0))
+ call assert_equal('+00.33', printf('%+06.2f', 1.0 / 3.0))
+ call assert_equal(' 00.33', printf('% 06.2f', 1.0 / 3.0))
+ call assert_equal('000.33', printf('%06.2g', 1.0 / 3.0))
+ call assert_equal('-00.33', printf('%06.2g', -1.0 / 3.0))
+ call assert_equal('0.33', printf('%3.2f', 1.0 / 3.0))
+ call assert_equal('003.33e-01', printf('%010.2e', 1.0 / 3.0))
+ call assert_equal(' 03.33e-01', printf('% 010.2e', 1.0 / 3.0))
+ call assert_equal('+03.33e-01', printf('%+010.2e', 1.0 / 3.0))
+ call assert_equal('-03.33e-01', printf('%010.2e', -1.0 / 3.0))
+
+ #" When precision is 0, the dot should be omitted.
+ call assert_equal(' 2', printf('%3.f', 7.0 / 3.0))
+ call assert_equal(' 2', printf('%3.g', 7.0 / 3.0))
+ call assert_equal(' 2e+00', printf('%7.e', 7.0 / 3.0))
+
+ #" Float zero can be signed.
+ call assert_equal('+0.000000', printf('%+f', 0.0))
+ call assert_equal('0.000000', printf('%f', 1.0 / (1.0 / 0.0)))
+ call assert_equal('-0.000000', printf('%f', 1.0 / (-1.0 / 0.0)))
+ call assert_equal('0.0', printf('%s', 1.0 / (1.0 / 0.0)))
+ call assert_equal('-0.0', printf('%s', 1.0 / (-1.0 / 0.0)))
+ call assert_equal('0.0', printf('%S', 1.0 / (1.0 / 0.0)))
+ call assert_equal('-0.0', printf('%S', 1.0 / (-1.0 / 0.0)))
+
+ #" Float infinity can be signed.
+ call assert_equal('inf', printf('%f', 1.0 / 0.0))
+ call assert_equal('-inf', printf('%f', -1.0 / 0.0))
+ call assert_equal('inf', printf('%g', 1.0 / 0.0))
+ call assert_equal('-inf', printf('%g', -1.0 / 0.0))
+ call assert_equal('inf', printf('%e', 1.0 / 0.0))
+ call assert_equal('-inf', printf('%e', -1.0 / 0.0))
+ call assert_equal('INF', printf('%F', 1.0 / 0.0))
+ call assert_equal('-INF', printf('%F', -1.0 / 0.0))
+ call assert_equal('INF', printf('%E', 1.0 / 0.0))
+ call assert_equal('-INF', printf('%E', -1.0 / 0.0))
+ call assert_equal('INF', printf('%E', 1.0 / 0.0))
+ call assert_equal('-INF', printf('%G', -1.0 / 0.0))
+ call assert_equal('+inf', printf('%+f', 1.0 / 0.0))
+ call assert_equal('-inf', printf('%+f', -1.0 / 0.0))
+ call assert_equal(' inf', printf('% f', 1.0 / 0.0))
+ call assert_equal(' inf', printf('%6f', 1.0 / 0.0))
+ call assert_equal(' -inf', printf('%6f', -1.0 / 0.0))
+ call assert_equal(' inf', printf('%6g', 1.0 / 0.0))
+ call assert_equal(' -inf', printf('%6g', -1.0 / 0.0))
+ call assert_equal(' +inf', printf('%+6f', 1.0 / 0.0))
+ call assert_equal(' inf', printf('% 6f', 1.0 / 0.0))
+ call assert_equal(' +inf', printf('%+06f', 1.0 / 0.0))
+ call assert_equal('inf ', printf('%-6f', 1.0 / 0.0))
+ call assert_equal('-inf ', printf('%-6f', -1.0 / 0.0))
+ call assert_equal('+inf ', printf('%-+6f', 1.0 / 0.0))
+ call assert_equal(' inf ', printf('%- 6f', 1.0 / 0.0))
+ call assert_equal('-INF ', printf('%-6F', -1.0 / 0.0))
+ call assert_equal('+INF ', printf('%-+6F', 1.0 / 0.0))
+ call assert_equal(' INF ', printf('%- 6F', 1.0 / 0.0))
+ call assert_equal('INF ', printf('%-6G', 1.0 / 0.0))
+ call assert_equal('-INF ', printf('%-6G', -1.0 / 0.0))
+ call assert_equal('INF ', printf('%-6E', 1.0 / 0.0))
+ call assert_equal('-INF ', printf('%-6E', -1.0 / 0.0))
+ call assert_equal('inf', printf('%s', 1.0 / 0.0))
+ call assert_equal('-inf', printf('%s', -1.0 / 0.0))
+
+ #" Test special case where max precision is truncated at 340.
+ call assert_equal('1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.330f', 1.0))
+ call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.340f', 1.0))
+ call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%.350f', 1.0))
+
+ #" Float nan (not a number) has no sign.
+ call assert_equal('nan', printf('%f', sqrt(-1.0)))
+ call assert_equal('nan', printf('%f', 0.0 / 0.0))
+ call assert_equal('nan', printf('%f', -0.0 / 0.0))
+ call assert_equal('nan', printf('%g', 0.0 / 0.0))
+ call assert_equal('nan', printf('%e', 0.0 / 0.0))
+ call assert_equal('NAN', printf('%F', 0.0 / 0.0))
+ call assert_equal('NAN', printf('%G', 0.0 / 0.0))
+ call assert_equal('NAN', printf('%E', 0.0 / 0.0))
+ call assert_equal('NAN', printf('%F', -0.0 / 0.0))
+ call assert_equal('NAN', printf('%G', -0.0 / 0.0))
+ call assert_equal('NAN', printf('%E', -0.0 / 0.0))
+ call assert_equal(' nan', printf('%6f', 0.0 / 0.0))
+ call assert_equal(' nan', printf('%06f', 0.0 / 0.0))
+ call assert_equal('nan ', printf('%-6f', 0.0 / 0.0))
+ call assert_equal('nan ', printf('%- 6f', 0.0 / 0.0))
+ call assert_equal('nan', printf('%s', 0.0 / 0.0))
+ call assert_equal('nan', printf('%s', -0.0 / 0.0))
+ call assert_equal('nan', printf('%S', 0.0 / 0.0))
+ call assert_equal('nan', printf('%S', -0.0 / 0.0))
+ END
+ call v9.CheckLegacyAndVim9Success(lines)
+
+ call v9.CheckLegacyAndVim9Failure(['echo printf("%f", "a")'], 'E807:')
endfunc
func Test_printf_errors()
@@ -585,10 +577,8 @@ func Test_printf_errors()
call v9.CheckLegacyAndVim9Failure(['echo printf("%d", 1, 2)'], 'E767:')
call v9.CheckLegacyAndVim9Failure(['echo printf("%*d", 1)'], 'E766:')
call v9.CheckLegacyAndVim9Failure(['echo printf("%s")'], 'E766:')
- if has('float')
- call v9.CheckLegacyAndVim9Failure(['echo printf("%d", 1.2)'], 'E805:')
- call v9.CheckLegacyAndVim9Failure(['echo printf("%f")'], 'E766:')
- endif
+ call v9.CheckLegacyAndVim9Failure(['echo printf("%d", 1.2)'], 'E805:')
+ call v9.CheckLegacyAndVim9Failure(['echo printf("%f")'], 'E766:')
endfunc
func Test_printf_64bit()
@@ -607,9 +597,7 @@ func Test_printf_spec_s()
call assert_equal("abcdefgi", printf('%s', "abcdefgi"))
#" float
- if has('float')
- call assert_equal("1.23", printf('%s', 1.23))
- endif
+ call assert_equal("1.23", printf('%s', 1.23))
#" list
VAR lvalue = [1, 'two', ['three', 4]]
@@ -878,8 +866,6 @@ endfunc
" Test for float value comparison
func Test_float_compare()
- CheckFeature float
-
let lines =<< trim END
call assert_true(1.2 == 1.2)
call assert_true(1.0 != 1.2)
diff --git a/src/testdir/test_float_func.vim b/src/testdir/test_float_func.vim
index 8ef1b9d5e..acc2e11e0 100644
--- a/src/testdir/test_float_func.vim
+++ b/src/testdir/test_float_func.vim
@@ -1,7 +1,6 @@
" test float functions
source check.vim
-CheckFeature float
import './vim9.vim' as v9
func Test_abs()
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 4c71e227a..ba6b790c0 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -54,14 +54,12 @@ func Test_empty()
call assert_equal(0, empty(1))
call assert_equal(0, empty(-1))
- if has('float')
- call assert_equal(1, empty(0.0))
- call assert_equal(1, empty(-0.0))
- call assert_equal(0, empty(1.0))
- call assert_equal(0, empty(-1.0))
- call assert_equal(0, empty(1.0/0.0))
- call assert_equal(0, empty(0.0/0.0))
- endif
+ call assert_equal(1, empty(0.0))
+ call assert_equal(1, empty(-0.0))
+ call assert_equal(0, empty(1.0))
+ call assert_equal(0, empty(-1.0))
+ call assert_equal(0, empty(1.0/0.0))
+ call assert_equal(0, empty(0.0/0.0))
call assert_equal(1, empty([]))
call assert_equal(0, empty(['a']))
@@ -90,9 +88,7 @@ endfunc
func Test_test_void()
call assert_fails('echo 1 == test_void()', 'E1031:')
- if has('float')
- call assert_fails('echo 1.0 == test_void()', 'E1031:')
- endif
+ call assert_fails('echo 1.0 == test_void()', 'E1031:')
call assert_fails('let x = json_encode(test_void())', 'E685:')
call assert_fails('let x = copy(test_void())', 'E685:')
call assert_fails('let x = copy([test_void()])', 'E1031:')
@@ -175,10 +171,8 @@ func Test_strwidth()
call assert_fails('call strwidth({})', 'E731:')
endfor
- if has('float')
- call assert_equal(3, strwidth(1.2))
- call v9.CheckDefAndScriptFailure(['echo strwidth(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1'])
- endif
+ call assert_equal(3, strwidth(1.2))
+ call v9.CheckDefAndScriptFailure(['echo strwidth(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1'])
set ambiwidth&
endfunc
@@ -242,10 +236,8 @@ func Test_str2nr()
call assert_fails('call str2nr([])', 'E730:')
call assert_fails('call str2nr({->2})', 'E729:')
- if has('float')
- call assert_equal(1, str2nr(1.2))
- call v9.CheckDefAndScriptFailure(['echo str2nr(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1'])
- endif
+ call assert_equal(1, str2nr(1.2))
+ call v9.CheckDefAndScriptFailure(['echo str2nr(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1'])
call assert_fails('call str2nr(10, [])', 'E745:')
endfunc
@@ -504,10 +496,8 @@ func Test_simplify()
call assert_fails('call simplify({->0})', 'E729:')
call assert_fails('call simplify([])', 'E730:')
call assert_fails('call simplify({})', 'E731:')
- if has('float')
- call assert_equal('1.2', simplify(1.2))
- call v9.CheckDefAndScriptFailure(['echo simplify(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1'])
- endif
+ call assert_equal('1.2', simplify(1.2))
+ call v9.CheckDefAndScriptFailure(['echo simplify(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1'])
endfunc
func Test_pathshorten()
diff --git a/src/testdir/test_glob2regpat.vim b/src/testdir/test_glob2regpat.vim
index 17ae3fcf2..965ca5c4a 100644
--- a/src/testdir/test_glob2regpat.vim
+++ b/src/testdir/test_glob2regpat.vim
@@ -3,10 +3,8 @@
import './vim9.vim' as v9
func Test_glob2regpat_invalid()
- if has('float')
- call assert_equal('^1\.33$', glob2regpat(1.33))
- call v9.CheckDefAndScriptFailure(['echo glob2regpat(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1'])
- endif
+ call assert_equal('^1\.33$', glob2regpat(1.33))
+ call v9.CheckDefAndScriptFailure(['echo glob2regpat(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1'])
call assert_fails('call glob2regpat("}")', 'E219:')
call assert_fails('call glob2regpat("{")', 'E220:')
endfunc
diff --git a/src/testdir/test_json.vim b/src/testdir/test_json.vim
index 3ee783703..96eddc23d 100644
--- a/src/testdir/test_json.vim
+++ b/src/testdir/test_json.vim
@@ -21,16 +21,14 @@ let s:jsonmb = '"s¢cĴgё"'
let s:varmb = "s¢cĴgё"
let s:jsonnr = '1234'
let s:varnr = 1234
-if has('float')
- let s:jsonfl = '12.34'
- let s:varfl = 12.34
- let s:jsonneginf = '-Infinity'
- let s:jsonposinf = 'Infinity'
- let s:varneginf = -1.0 / 0.0
- let s:varposinf = 1.0 / 0.0
- let s:jsonnan = 'NaN'
- let s:varnan = 0.0 / 0.0
-endif
+let s:jsonfl = '12.34'
+let s:varfl = 12.34
+let s:jsonneginf = '-Infinity'
+let s:jsonposinf = 'Infinity'
+let s:varneginf = -1.0 / 0.0
+let s:varposinf = 1.0 / 0.0
+let s:jsonnan = 'NaN'
+let s:varnan = 0.0 / 0.0
let s:jsonl1 = '[1,"a",3]'
let s:varl1 = [1, "a", 3]
@@ -82,12 +80,10 @@ func Test_json_encode()
" no test for surrogate pair, json_encode() doesn't create them.
call assert_equal(s:jsonnr, json_encode(s:varnr))
- if has('float')
- call assert_equal(s:jsonfl, json_encode(s:varfl))
- call assert_equal(s:jsonneginf, json_encode(s:varneginf))
- call assert_equal(s:jsonposinf, json_encode(s:varposinf))
- call assert_equal(s:jsonnan, json_encode(s:varnan))
- endif
+ call assert_equal(s:jsonfl, json_encode(s:varfl))
+ call assert_equal(s:jsonneginf, json_encode(s:varneginf))
+ call assert_equal(s:jsonposinf, json_encode(s:varposinf))
+ call assert_equal(s:jsonnan, json_encode(s:varnan))
call assert_equal(s:jsonl1, json_encode(s:varl1))
call assert_equal(s:jsonl2, json_encode(s:varl2))
@@ -133,9 +129,7 @@ func Test_json_decode()
call assert_equal(s:varsp2, json_decode(s:jsonsp2))
call assert_equal(s:varnr, json_decode(s:jsonnr))
- if has('float')
- call assert_equal(s:varfl, json_decode(s:jsonfl))
- endif
+ call assert_equal(s:varfl, json_decode(s:jsonfl))
call assert_equal(s:varl1, json_decode(s:jsonl1))
call assert_equal(s:varl2x, json_decode(s:jsonl2))
@@ -189,9 +183,7 @@ func Test_json_decode()
call assert_fails('call json_decode("{\"n\":1,")', "E491:")
call assert_fails('call json_decode("{\"n\",1}")', "E491:")
call assert_fails('call json_decode("{-}")', "E491:")
- if has('float')
- call assert_fails('call json_decode("{3.14:1}")', "E806:")
- endif
+ call assert_fails('call json_decode("{3.14:1}")', "E806:")
call assert_fails('call json_decode("[foobar]")', "E491:")
call assert_fails('call json_decode("[")', "E491:")
@@ -230,12 +222,10 @@ func Test_js_encode()
" no test for surrogate pair, js_encode() doesn't create them.
call assert_equal(s:jsonnr, js_encode(s:varnr))
- if has('float')
- call assert_equal(s:jsonfl, js_encode(s:varfl))
- call assert_equal(s:jsonneginf, js_encode(s:varneginf))
- call assert_equal(s:jsonposinf, js_encode(s:varposinf))
- call assert_equal(s:jsonnan, js_encode(s:varnan))
- endif
+ call assert_equal(s:jsonfl, js_encode(s:varfl))
+ call assert_equal(s:jsonneginf, js_encode(s:varneginf))
+ call assert_equal(s:jsonposinf, js_encode(s:varposinf))
+ call assert_equal(s:jsonnan, js_encode(s:varnan))
call assert_equal(s:jsonl1, js_encode(s:varl1))
call assert_equal(s:jsonl2, js_encode(s:varl2))
@@ -270,12 +260,10 @@ func Test_js_decode()
call assert_equal(s:varsp2, js_decode(s:jsonsp2))
call assert_equal(s:varnr, js_decode(s:jsonnr))
- if has('float')
- call assert_equal(s:varfl, js_decode(s:jsonfl))
- call assert_equal(s:varneginf, js_decode(s:jsonneginf))
- call assert_equal(s:varposinf, js_decode(s:jsonposinf))
- call assert_true(isnan(js_decode(s:jsonnan)))
- endif
+ call assert_equal(s:varfl, js_decode(s:jsonfl))
+ call assert_equal(s:varneginf, js_decode(s:jsonneginf))
+ call assert_equal(s:varposinf, js_decode(s:jsonposinf))
+ call assert_true(isnan(js_decode(s:jsonnan)))
call assert_equal(s:varl1, js_decode(s:jsonl1))
call assert_equal(s:varl2x, js_decode(s:jsonl2))
diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim
index 63ba47fab..4476e2be2 100644
--- a/src/testdir/test_listdict.vim
+++ b/src/testdir/test_listdict.vim
@@ -966,20 +966,18 @@ func Test_reverse_sort_uniq()
call assert_equal(['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5], uniq(copy(l)))
call assert_equal([1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0'], reverse(l))
call assert_equal([1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0'], reverse(reverse(l)))
- if has('float')
- call assert_equal(['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]], sort(l))
- call assert_equal([[0, 1, 2], [0, 1, 2], 4, 2, 2, 1.5, 'xaaa', 'x8', 'foo6', 'foo', 'foo', 'A11', '-0'], reverse(sort(l)))
- call assert_equal(['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]], sort(reverse(sort(l))))
- call assert_equal(['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 4, [0, 1, 2]], uniq(sort(l)))
-
- LET l = [7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff, 0.22, 'four']
- call assert_equal([-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255], sort(copy(l), 'n'))
-
- LET l = [7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []]
- call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i'))
- call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i'))
- call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l)))
- endif
+ call assert_equal(['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]], sort(l))
+ call assert_equal([[0, 1, 2], [0, 1, 2], 4, 2, 2, 1.5, 'xaaa', 'x8', 'foo6', 'foo', 'foo', 'A11', '-0'], reverse(sort(l)))
+ call assert_equal(['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]], sort(reverse(sort(l))))
+ call assert_equal(['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 4, [0, 1, 2]], uniq(sort(l)))
+
+ LET l = [7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff, 0.22, 'four']
+ call assert_equal([-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255], sort(copy(l), 'n'))
+
+ LET l = [7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []]
+ call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i'))
+ call assert_equal(['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l), 'i'))
+ call assert_equal(['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}], sort(copy(l)))
END
call v9.CheckLegacyAndVim9Success(lines)
@@ -1173,9 +1171,7 @@ func Test_listdict_extend()
let l = [1, 2, 3]
call assert_fails("call extend(l, [4, 5, 6], 4)", 'E684:')
call assert_fails("call extend(l, [4, 5, 6], -4)", 'E684:')
- if has('float')
- call assert_fails("call extend(l, [4, 5, 6], 1.2)", 'E805:')
- endif
+ call assert_fails("call extend(l, [4, 5, 6], 1.2)", 'E805:')
" Test extend() with dictionaries.
@@ -1203,9 +1199,7 @@ func Test_listdict_extend()
call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'error')", 'E737:')
call assert_fails("call extend(d, {'b': 0}, [])", 'E730:')
call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'xxx')", 'E475:')
- if has('float')
- call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 1.2)", 'E475:')
- endif
+ call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 1.2)", 'E475:')
call assert_equal({'a': 'A', 'b': 'B'}, d)
call assert_fails("call extend([1, 2], 1)", 'E712:')
diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim
index 7fcd13d7d..2a08607ff 100644
--- a/src/testdir/test_lua.vim
+++ b/src/testdir/test_lua.vim
@@ -10,7 +10,6 @@ func Test_skip_lua()
endfunc
CheckFeature lua
-CheckFeature float
" Depending on the lua version, the error messages are different.
let [s:major, s:minor, s:patch] = luaeval('vim.lua_version')->split('\.')->map({-> str2nr(v:val)})
diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim
index 6dc9a5b80..e35fb0c38 100644
--- a/src/testdir/test_messages.vim
+++ b/src/testdir/test_messages.vim
@@ -74,9 +74,7 @@ func Test_echomsg()
call assert_equal("\n[1, 2, []]", execute(':echomsg [1, 2, test_null_list()]'))
call assert_equal("\n{}", execute(':echomsg {}'))
call assert_equal("\n{'a': 1, 'b': 2}", execute(':echomsg {"a": 1, "b": 2}'))
- if has('float')
- call assert_equal("\n1.23", execute(':echomsg 1.23'))
- endif
+ call assert_equal("\n1.23", execute(':echomsg 1.23'))
call assert_match("function('<lambda>\\d*')", execute(':echomsg {-> 1234}'))
endfunc
@@ -86,9 +84,7 @@ func Test_echoerr()
call assert_equal("\n12345 IgNoRe", execute(':echoerr 12345 "IgNoRe"'))
call assert_equal("\n[1, 2, 'IgNoRe']", execute(':echoerr [1, 2, "IgNoRe"]'))
call assert_equal("\n{'IgNoRe': 2, 'a': 1}", execute(':echoerr {"a": 1, "IgNoRe": 2}'))
- if has('float')
- call assert_equal("\n1.23 IgNoRe", execute(':echoerr 1.23 "IgNoRe"'))
- endif
+ call assert_equal("\n1.23 IgNoRe", execute(':echoerr 1.23 "IgNoRe"'))
eval '<lambda>'->test_ignore_error()
call assert_match("function('<lambda>\\d*')", execute(':echoerr {-> 1234}'))
call test_ignore_error('RESET')
diff --git a/src/testdir/test_method.vim b/src/testdir/test_method.vim
index d31cce187..29734e049 100644
--- a/src/testdir/test_method.vim
+++ b/src/testdir/test_method.vim
@@ -121,7 +121,6 @@ func Test_method_funcref()
endfunc
func Test_method_float()
- CheckFeature float
eval 1.234->string()->assert_equal('1.234')
eval -1.234->string()->assert_equal('-1.234')
endfunc
diff --git a/src/testdir/test_perl.vim b/src/testdir/test_perl.vim
index cf4ca7573..681aaae73 100644
--- a/src/testdir/test_perl.vim
+++ b/src/testdir/test_perl.vim
@@ -163,11 +163,7 @@ func Test_perleval()
call assert_equal(0, perleval('0'))
call assert_equal(2, perleval('2'))
call assert_equal(-2, perleval('-2'))
- if has('float')
- call assert_equal(2.5, perleval('2.5'))
- else
- call assert_equal(2, perleval('2.5'))
- end
+ call assert_equal(2.5, perleval('2.5'))
sandbox call assert_equal(2, perleval('2'))
diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim
index af1e340fa..066b4bd88 100644
--- a/src/testdir/test_python2.vim
+++ b/src/testdir/test_python2.vim
@@ -686,7 +686,6 @@ func Test_python_function_call()
endfunc
func Test_python_float()
- CheckFeature float
let l = [0.0]
py l = vim.bindeval('l')
py l.extend([0.0])
@@ -785,9 +784,7 @@ func Test_python_pyeval()
py v = vim.eval('test_null_function()')
call assert_equal(v:none, pyeval('v'))
- if has('float')
- call assert_equal(0.0, pyeval('0.0'))
- endif
+ call assert_equal(0.0, pyeval('0.0'))
" Evaluate an invalid values
call AssertException(['let v = pyeval(''"\0"'')'], 'E859:')
diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim
index 437da513b..58082278c 100644
--- a/src/testdir/test_python3.vim
+++ b/src/testdir/test_python3.vim
@@ -286,16 +286,14 @@ endfunc
" Test vim.eval() with various types.
func Test_python3_vim_val()
call assert_equal("\n8", execute('py3 print(vim.eval("3+5"))'))
- if has('float')
- call assert_equal("\n3.140000", execute('py3 print(vim.eval("1.01+2.13"))'))
- call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))'))
- call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))'))
- call assert_equal("\n-0.000000", execute('py3 print(vim.eval("0.0/(-1.0/0.0)"))'))
- " Commented out: output of infinity and nan depend on platforms.
- " call assert_equal("\ninf", execute('py3 print(vim.eval("1.0/0.0"))'))
- " call assert_equal("\n-inf", execute('py3 print(vim.eval("-1.0/0.0"))'))
- " call assert_equal("\n-nan", execute('py3 print(vim.eval("0.0/0.0"))'))
- endif
+ call assert_equal("\n3.140000", execute('py3 print(vim.eval("1.01+2.13"))'))
+ call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))'))
+ call assert_equal("\n0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))'))
+ call assert_equal("\n-0.000000", execute('py3 print(vim.eval("0.0/(-1.0/0.0)"))'))
+ " Commented out: output of infinity and nan depend on platforms.
+ " call assert_equal("\ninf", execute('py3 print(vim.eval("1.0/0.0"))'))
+ " call assert_equal("\n-inf", execute('py3 print(vim.eval("-1.0/0.0"))'))
+ " call assert_equal("\n-nan", execute('py3 print(vim.eval("0.0/0.0"))'))
call assert_equal("\nabc", execute('py3 print(vim.eval("\"abc\""))'))
call assert_equal("\n['1', '2']", execute('py3 print(vim.eval("[1, 2]"))'))
call assert_equal("\n{'1': '2'}", execute('py3 print(vim.eval("{1:2}"))'))
@@ -879,7 +877,6 @@ func Test_python3_function_call()
endfunc
func Test_python3_float()
- CheckFeature float
let l = [0.0]
py3 l = vim.bindeval('l')
py3 l.extend([0.0])
@@ -982,9 +979,7 @@ func Test_python3_pyeval()
py3 v = vim.eval('test_null_function()')
call assert_equal(v:none, py3eval('v'))
- if has('float')
- call assert_equal(0.0, py3eval('0.0'))
- endif
+ call assert_equal(0.0, py3eval('0.0'))
" Evaluate an invalid values
call AssertException(['let v = py3eval(''"\0"'')'], 'E859:')
diff --git a/src/testdir/test_random.vim b/src/testdir/test_random.vim
index 1457310bd..afb3044e7 100644
--- a/src/testdir/test_random.vim
+++ b/src/testdir/test_random.vim
@@ -26,9 +26,7 @@ func Test_Rand()
call assert_equal(1001954530, rand())
call test_srand_seed()
- if has('float')
- call assert_fails('echo srand(1.2)', 'E805:')
- endif
+ call assert_fails('echo srand(1.2)', 'E805:')
call assert_fails('echo srand([1])', 'E745:')
call assert_fails('echo rand("burp")', 'E475:')
call assert_fails('echo rand([1, 2, 3])', 'E730:')
diff --git a/src/testdir/test_reltime.vim b/src/testdir/test_reltime.vim
index 2f2e7aed7..54104d511 100644
--- a/src/testdir/test_reltime.vim
+++ b/src/testdir/test_reltime.vim
@@ -2,7 +2,6 @@
source check.vim
CheckFeature reltime
-CheckFeature float
func Test_reltime()
let g:test_is_flaky = 1
diff --git a/src/testdir/test_ruby.vim b/src/testdir/test_ruby.vim
index 321ec4032..224dffb99 100644
--- a/src/testdir/test_ruby.vim
+++ b/src/testdir/test_ruby.vim
@@ -304,10 +304,8 @@ func Test_ruby_Vim_evaluate()
" on versions of Ruby.
call assert_match('^Integer\|Fixnum$', rubyeval('Vim::evaluate("123").class'))
- if has('float')
- call assert_equal(1.23, rubyeval('Vim::evaluate("1.23")'))
- call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class'))
- endif
+ call assert_equal(1.23, rubyeval('Vim::evaluate("1.23")'))
+ call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class'))
call assert_equal('foo', rubyeval('Vim::evaluate("\"foo\"")'))
call assert_equal('String', rubyeval('Vim::evaluate("\"foo\"").class'))
diff --git a/src/testdir/test_sort.vim b/src/testdir/test_sort.vim
index 783ca9ed7..124948e26 100644
--- a/src/testdir/test_sort.vim
+++ b/src/testdir/test_sort.vim
@@ -62,7 +62,6 @@ func Test_sort_numbers()
endfunc
func Test_sort_float()
- CheckFeature float
call assert_equal([0.28, 3, 13.5], sort([13.5, 0.28, 3], 'f'))
endfunc
@@ -72,8 +71,6 @@ func Test_sort_nested()
endfunc
func Test_sort_default()
- CheckFeature float
-
" docs say omitted, empty or zero argument sorts on string representation.
call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"]))
call assert_equal(['2', 'A', 'AA', 'a', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], ''))
@@ -1336,34 +1333,32 @@ func Test_sort_cmd()
\ ]
endif
endif
- if has('float')
- let tests += [
- \ {
- \ 'name' : 'float',
- \ 'cmd' : 'sort f',
- \ 'input' : [
- \ '1.234',
- \ '0.88',
- \ ' + 123.456',
- \ '1.15e-6',
- \ '-1.1e3',
- \ '-1.01e3',
- \ '',
- \ ''
- \ ],
- \ 'expected' : [
- \ '',
- \ '',
- \ '-1.1e3',
- \ '-1.01e3',
- \ '1.15e-6',
- \ '0.88',
- \ '1.234',
- \ ' + 123.456'
- \ ]
- \ },
- \ ]
- endif
+ let tests += [
+ \ {
+ \ 'name' : 'float',
+ \ 'cmd' : 'sort f',
+ \ 'input' : [
+ \ '1.234',
+ \ '0.88',
+ \ ' + 123.456',
+ \ '1.15e-6',
+ \ '-1.1e3',
+ \ '-1.01e3',
+ \ '',
+ \ ''
+ \ ],
+ \ 'expected' : [
+ \ '',
+ \ '',
+ \ '-1.1e3',
+ \ '-1.01e3',
+ \ '1.15e-6',
+ \ '0.88',
+ \ '1.234',
+ \ ' + 123.456'
+ \ ]
+ \ },
+ \ ]
for t in tests
enew!
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index 9bbe99763..1e73ba69b 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -464,8 +464,6 @@ func Test_substitute_partial()
endfunc
func Test_substitute_float()
- CheckFeature float
-
call assert_equal('number 1.23', substitute('number ', '$', { -> 1.23 }, ''))
vim9 assert_equal('number 1.23', substitute('number ', '$', () => 1.23, ''))
endfunc
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 81e659ea5..fd427fe80 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -478,9 +478,7 @@ func Test_terminal_size()
call assert_fails("call term_start(cmd, {'term_rows': -1})", 'E475:')
call assert_fails("call term_start(cmd, {'term_rows': 1001})", 'E475:')
- if has('float')
- call assert_fails("call term_start(cmd, {'term_rows': 10.0})", 'E805:')
- endif
+ call assert_fails("call term_start(cmd, {'term_rows': 10.0})", 'E805:')
call delete('Xtext')
endfunc
diff --git a/src/testdir/test_true_false.vim b/src/testdir/test_true_false.vim
index 2071f5ebd..4e95441a8 100644
--- a/src/testdir/test_true_false.vim
+++ b/src/testdir/test_true_false.vim
@@ -43,9 +43,7 @@ func Test_if()
call assert_fails('if [1]', 'E745:')
call assert_fails('if {1: 1}', 'E728:')
call assert_fails('if function("string")', 'E703:')
- if has('float')
- call assert_fails('if 1.3")', 'E805:')
- endif
+ call assert_fails('if 1.3")', 'E805:')
endfunc
function Try_arg_true_false(expr, false_val, true_val)
@@ -117,7 +115,6 @@ func Test_true_false_arg()
endfunc
function Try_arg_non_zero(expr, false_val, true_val)
- CheckFeature float
for v in ['v:false', '0', '[1]', '{2:3}', '3.4']
let r = eval(substitute(a:expr, '%v%', v, ''))
call assert_equal(a:false_val, r, 'result for ' . v . ' is not ' . a:false_val . ' but ' . r)
diff --git a/src/testdir/test_user_func.vim b/src/testdir/test_user_func.vim
index 4721175e7..4a74bc0be 100644
--- a/src/testdir/test_user_func.vim
+++ b/src/testdir/test_user_func.vim
@@ -129,11 +129,9 @@ func MakeBadFunc()
endfunc
func Test_default_arg()
- if has('float')
- call assert_equal(1.0, Log(10))
- call assert_equal(log(10), Log(10, exp(1)))
- call assert_fails("call Log(1,2,3)", 'E118:')
- endif
+ call assert_equal(1.0, Log(10))
+ call assert_equal(log(10), Log(10, exp(1)))
+ call assert_fails("call Log(1,2,3)", 'E118:')
let res = Args(1)
call assert_equal(res.mandatory, 1)
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim
index 11d7425e6..730212d10 100644
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -96,9 +96,7 @@ def Test_assignment()
# calling job_start() is in test_vim9_fails.vim, it causes leak reports
endif
- if has('float')
- var float1: float = 3.4
- endif
+ var float1: float = 3.4
var Funky1: func
var Funky2: func = function('len')
var Party2: func = funcref('g:Test_syntax')
@@ -147,17 +145,15 @@ def Test_assignment()
&ts %= 4
assert_equal(2, &ts)
- if has('float')
- var f100: float = 100.0
- f100 /= 5
- assert_equal(20.0, f100)
+ var f100: float = 100.0
+ f100 /= 5
+ assert_equal(20.0, f100)
- var f200: float = 200.0
- f200 /= 5.0
- assert_equal(40.0, f200)
+ var f200: float = 200.0
+ f200 /= 5.0
+ assert_equal(40.0, f200)
- v9.CheckDefFailure(['var nr: number = 200', 'nr /= 5.0'], 'E1012:')
- endif
+ v9.CheckDefFailure(['var nr: number = 200', 'nr /= 5.0'], 'E1012:')
lines =<< trim END
&ts = 6
@@ -227,11 +223,9 @@ def Test_assignment()
g:inc_counter += 1
assert_equal(2, g:inc_counter)
- if has('float')
- var f: float
- f += 1
- assert_equal(1.0, f)
- endif
+ var f: float
+ f += 1
+ assert_equal(1.0, f)
$SOME_ENV_VAR ..= 'more'
assert_equal('somemore', $SOME_ENV_VAR)
@@ -250,20 +244,16 @@ def Test_assignment()
enddef
def Test_float_and_number()
- if !has('float')
- MissingFeature float
- else
- var lines =<< trim END
- var f: float
- f += 2
- f -= 1
- assert_equal(1.0, f)
- ++f
- --f
- assert_equal(1.0, f)
- END
- v9.CheckDefAndScriptSuccess(lines)
- endif
+ var lines =<< trim END
+ var f: float
+ f += 2
+ f -= 1
+ assert_equal(1.0, f)
+ ++f
+ --f
+ assert_equal(1.0, f)
+ END
+ v9.CheckDefAndScriptSuccess(lines)
enddef
let g:someNumber = 43
@@ -1314,10 +1304,8 @@ def Test_assignment_default()
var thenumber: number
assert_equal(0, thenumber)
- if has('float')
- var thefloat: float
- assert_equal(0.0, thefloat)
- endif
+ var thefloat: float
+ assert_equal(0.0, thefloat)
var thestring: string
assert_equal('', thestring)
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index dccd99bb3..fb21683c0 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -69,11 +69,9 @@ def Test_abs()
assert_equal(2, abs(-2))
assert_equal(3, abs(3))
v9.CheckDefAndScriptFailure(['abs("text")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1'])
- if has('float')
- assert_equal(0, abs(0))
- assert_equal(2.0, abs(-2.0))
- assert_equal(3.0, abs(3.0))
- endif
+ assert_equal(0, abs(0))
+ assert_equal(2.0, abs(-2.0))
+ assert_equal(3.0, abs(3.0))
enddef
def Test_add()
@@ -1283,8 +1281,6 @@ enddef
" Test for float functions argument type
def Test_float_funcs_args()
- CheckFeature float
-
# acos()
v9.CheckDefAndScriptFailure(['acos("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1219: Float or Number required for argument 1'])
assert_equal('1.570796', string(acos(0.0)))
@@ -4064,15 +4060,11 @@ def Test_state()
enddef
def Test_str2float()
- if !has('float')
- CheckFeature float
- else
- str2float("1.00")->assert_equal(1.00)
- str2float("2e-2")->assert_equal(0.02)
- str2float('')->assert_equal(0.0)
+ str2float("1.00")->assert_equal(1.00)
+ str2float("2e-2")->assert_equal(0.02)
+ str2float('')->assert_equal(0.0)
- v9.CheckDefAndScriptFailure(['str2float(123)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1'])
- endif
+ v9.CheckDefAndScriptFailure(['str2float(123)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1'])
enddef
def Test_str2list()
@@ -4585,9 +4577,7 @@ def Test_trim()
enddef
def Test_typename()
- if has('float')
- assert_equal('func([unknown], [unknown]): float', typename(function('pow')))
- endif
+ assert_equal('func([unknown], [unknown]): float', typename(function('pow')))
assert_equal('func(...): unknown', test_null_partial()->typename())
assert_equal('list<unknown>', test_null_list()->typename())
assert_equal('dict<unknown>', test_null_dict()->typename())
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index 67cd9095d..d4a520f14 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -309,9 +309,7 @@ def s:ScriptFuncPush()
var localbool = true
var localspec = v:none
var localblob = 0z1234
- if has('float')
- var localfloat = 1.234
- endif
+ var localfloat = 1.234
enddef
def Test_disassemble_push()
@@ -1742,13 +1740,11 @@ def s:Computing()
anyres = g:number / 7
anyres = g:number % 7
- if has('float')
- var fl = 3.0
- var flres = fl + 7.0
- flres = fl - 7.0
- flres = fl * 7.0
- flres = fl / 7.0
- endif
+ var fl = 3.0
+ var flres = fl + 7.0
+ flres = fl - 7.0
+ flres = fl * 7.0
+ flres = fl / 7.0
enddef
def Test_disassemble_computing()
@@ -1783,24 +1779,22 @@ def Test_disassemble_computing()
'anyres = g:number % 7.*' ..
'\d OPANY %.*',
instr)
- if has('float')
- assert_match('Computing.*' ..
- 'var fl = 3.0.*' ..
- '\d PUSHF 3.0.*' ..
- '\d STORE $3.*' ..
- 'var flres = fl + 7.0.*' ..
- '\d LOAD $3.*' ..
- '\d PUSHF 7.0.*' ..
- '\d OPFLOAT +.*' ..
- '\d STORE $4.*' ..
- 'flres = fl - 7.0.*' ..
- '\d OPFLOAT -.*' ..
- 'flres = fl \* 7.0.*' ..
- '\d OPFLOAT \*.*' ..
- 'flres = fl / 7.0.*' ..
- '\d OPFLOAT /.*',
- instr)
- endif
+ assert_match('Computing.*' ..
+ 'var fl = 3.0.*' ..
+ '\d PUSHF 3.0.*' ..
+ '\d STORE $3.*' ..
+ 'var flres = fl + 7.0.*' ..
+ '\d LOAD $3.*' ..
+ '\d PUSHF 7.0.*' ..
+ '\d OPFLOAT +.*' ..
+ '\d STORE $4.*' ..
+ 'flres = fl - 7.0.*' ..
+ '\d OPFLOAT -.*' ..
+ 'flres = fl \* 7.0.*' ..
+ '\d OPFLOAT \*.*' ..
+ 'flres = fl / 7.0.*' ..
+ '\d OPFLOAT /.*',
+ instr)
enddef
def s:AddListBlob()
@@ -2178,19 +2172,17 @@ def Test_disassemble_compare()
['77 isnot g:xx', 'COMPAREANY isnot'],
]
var floatDecl = ''
- if has('float')
- cases->extend([
- ['1.1 == aFloat', 'COMPAREFLOAT =='],
- ['1.1 != aFloat', 'COMPAREFLOAT !='],
- ['1.1 > aFloat', 'COMPAREFLOAT >'],
- ['1.1 < aFloat', 'COMPAREFLOAT <'],
- ['1.1 >= aFloat', 'COMPAREFLOAT >='],
- ['1.1 <= aFloat', 'COMPAREFLOAT <='],
- ['1.1 =~ aFloat', 'COMPAREFLOAT =\~'],
- ['1.1 !~ aFloat', 'COMPAREFLOAT !\~'],
- ])
- floatDecl = 'var aFloat = 2.2'
- endif
+ cases->extend([
+ ['1.1 == aFloat', 'COMPAREFLOAT =='],
+ ['1.1 != aFloat', 'COMPAREFLOAT !='],
+ ['1.1 > aFloat', 'COMPAREFLOAT >'],
+ ['1.1 < aFloat', 'COMPAREFLOAT <'],
+ ['1.1 >= aFloat', 'COMPAREFLOAT >='],
+ ['1.1 <= aFloat', 'COMPAREFLOAT <='],
+ ['1.1 =~ aFloat', 'COMPAREFLOAT =\~'],
+ ['1.1 !~ aFloat', 'COMPAREFLOAT !\~'],
+ ])
+ floatDecl = 'var aFloat = 2.2'
var nr = 1
for case in cases
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index 9bb053fe7..44e221a90 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -18,9 +18,7 @@ def Test_expr1_ternary()
assert_equal('one', 1 ?
'one' :
'two')
- if has('float')
- assert_equal('one', !!0.1 ? 'one' : 'two')
- endif
+ assert_equal('one', !!0.1 ? 'one' : 'two')
assert_equal('one', !!'x' ? 'one' : 'two')
assert_equal('one', !!'x'
? 'one'
@@ -33,9 +31,7 @@ def Test_expr1_ternary()
assert_equal('two', false ? 'one' : 'two')
assert_equal('two', 0 ? 'one' : 'two')
- if has('float')
- assert_equal('two', !!0.0 ? 'one' : 'two')
- endif
+ assert_equal('two', !!0.0 ? 'one' : 'two')
assert_equal('two', !!'' ? 'one' : 'two')
assert_equal('two', !!0z ? 'one' : 'two')
assert_equal('two', !![] ? 'one' : 'two')
@@ -208,9 +204,7 @@ func Test_expr1_ternary_fails()
call v9.CheckDefExecAndScriptFailure(["var x = true ? xxx : 'foo'"], ['E1001:', 'E121:'], 1)
call v9.CheckDefExecAndScriptFailure(["var x = false ? 'foo' : xxx"], ['E1001:', 'E121:'], 1)
- if has('float')
- call v9.CheckDefAndScriptFailure(["var x = 0.1 ? 'one' : 'two'"], 'E805:', 1)
- endif
+ call v9.CheckDefAndScriptFailure(["var x = 0.1 ? 'one' : 'two'"], 'E805:', 1)
" missing argument detected even when common type is used
call v9.CheckDefAndScriptFailure([
@@ -227,18 +221,14 @@ def Test_expr1_falsy()
assert_equal('yes', 'yes' ?? 456)
assert_equal([1], [1] ?? 456)
assert_equal({one: 1}, {one: 1} ?? 456)
- if has('float')
- assert_equal(0.1, 0.1 ?? 456)
- endif
+ assert_equal(0.1, 0.1 ?? 456)
assert_equal(456, v:false ?? 456)
assert_equal(456, 0 ?? 456)
assert_equal(456, '' ?? 456)
assert_equal(456, [] ?? 456)
assert_equal(456, {} ?? 456)
- if has('float')
- assert_equal(456, 0.0 ?? 456)
- endif
+ assert_equal(456, 0.0 ?? 456)
END
v9.CheckDefAndScriptSuccess(lines)
@@ -567,9 +557,7 @@ let anull = v:null
let anint = 10
let theone = 1
let thefour = 4
-if has('float')
- let afloat = 0.1
-endif
+let afloat = 0.1
let astring = 'asdf'
let ablob = 0z01ab
let alist = [2, 3, 4]
@@ -605,20 +593,18 @@ def Test_expr4_equal()
assert_equal(true, g:anint == 10)
assert_equal(false, 61 == g:anint)
- if has('float')
- var ff = 0.3
- assert_equal(true, ff == 0.3)
- assert_equal(false, 0.4 == ff)
- assert_equal(true, 0.1 == g:afloat)
- assert_equal(false, g:afloat == 0.3)
-
- ff = 3.0
- assert_equal(true, ff == 3)
- assert_equal(true, 3 == ff)
- ff = 3.1
- assert_equal(false, ff == 3)
- assert_equal(false, 3 == ff)
- endif
+ var ff = 0.3
+ assert_equal(true, ff == 0.3)
+ assert_equal(false, 0.4 == ff)
+ assert_equal(true, 0.1 == g:afloat)
+ assert_equal(false, g:afloat == 0.3)
+
+ ff = 3.0
+ assert_equal(true, ff == 3)
+ assert_equal(true, 3 == ff)
+ ff = 3.1
+ assert_equal(false, ff == 3)
+ assert_equal(false, 3 == ff)
assert_equal(true, 'abc' == 'abc')
assert_equal(false, 'xyz' == 'abc')
@@ -706,20 +692,18 @@ def Test_expr4_equal()
v9.CheckScriptFailure(lines, 'E1030: Using a String as a Number: "3"')
assert_true(g:notReached)
- if has('float')
- lines =<< trim END
- vim9script
- var n: any = 2.2
- def Compare()
- eval n == '3'
- g:notReached = false
- enddef
- g:notReached = true
- Compare()
- END
- v9.CheckScriptFailure(lines, 'E892: Using a String as a Float')
- assert_true(g:notReached)
- endif
+ lines =<< trim END
+ vim9script
+ var n: any = 2.2
+ def Compare()
+ eval n == '3'
+ g:notReached = false
+ enddef
+ g:notReached = true
+ Compare()
+ END
+ v9.CheckScriptFailure(lines, 'E892: Using a String as a Float')
+ assert_true(g:notReached)
unlet g:notReached
enddef
@@ -746,16 +730,14 @@ def Test_expr4_compare_null()
assert_true(null != 123)
assert_true(null != 0)
- if has('float')
- assert_false(12.3 == null)
- assert_false(0.0 == null)
- assert_false(null == 12.3)
- assert_false(null == 0.0)
- assert_true(12.3 != null)
- assert_true(0.0 != null)
- assert_true(null != 12.3)
- assert_true(null != 0.0)
- endif
+ assert_false(12.3 == null)
+ assert_false(0.0 == null)
+ assert_false(null == 12.3)
+ assert_false(null == 0.0)
+ assert_true(12.3 != null)
+ assert_true(0.0 != null)
+ assert_true(null != 12.3)
+ assert_true(null != 0.0)
assert_true(test_null_blob() == v:null)
assert_true(null_blob == null)
@@ -1077,20 +1059,18 @@ def Test_expr4_notequal()
assert_equal(false, g:anint != 10)
assert_equal(true, 61 != g:anint)
- if has('float')
- var ff = 0.3
- assert_equal(false, 0.3 != ff)
- assert_equal(true, 0.4 != ff)
- assert_equal(false, 0.1 != g:afloat)
- assert_equal(true, g:afloat != 0.3)
-
- ff = 3.0
- assert_equal(false, ff != 3)
- assert_equal(false, 3 != ff)
- ff = 3.1
- assert_equal(true, ff != 3)
- assert_equal(true, 3 != ff)
- endif
+ var ff = 0.3
+ assert_equal(false, 0.3 != ff)
+ assert_equal(true, 0.4 != ff)
+ assert_equal(false, 0.1 != g:afloat)
+ assert_equal(true, g:afloat != 0.3)
+
+ ff = 3.0
+ assert_equal(false, ff != 3)
+ assert_equal(false, 3 != ff)
+ ff = 3.1
+ assert_equal(true, ff != 3)
+ assert_equal(true, 3 != ff)
assert_equal(false, 'abc' != 'abc')
assert_equal(true, 'xyz' != 'abc')
@@ -1149,13 +1129,11 @@ def Test_expr4_greater()
assert_false(nr2 > 2)
assert_false(nr2
> 3)
- if has('float')
- var ff = 2.0
- assert_true(ff > 0.0)
- assert_true(ff > 1.0)
- assert_false(ff > 2.0)
- assert_false(ff > 3.0)
- endif
+ var ff = 2.0
+ assert_true(ff > 0.0)
+ assert_true(ff > 1.0)
+ assert_false(ff > 2.0)
+ assert_false(ff > 3.0)
END
v9.CheckDefAndScriptSuccess(lines)
enddef
@@ -1171,12 +1149,10 @@ def Test_expr4_greaterequal()
assert_true(nr2 >= 0)
assert_true(nr2 >= 2)
assert_false(nr2 >= 3)
- if has('float')
- var ff = 2.0
- assert_true(ff >= 0.0)
- assert_true(ff >= 2.0)
- assert_false(ff >= 3.0)
- endif
+ var ff = 2.0
+ assert_true(ff >= 0.0)
+ assert_true(ff >= 2.0)
+ assert_false(ff >= 3.0)
END
v9.CheckDefAndScriptSuccess(lines)
enddef
@@ -1193,12 +1169,10 @@ def Test_expr4_smaller()
assert_false(nr2 < 0)
assert_false(nr2 < 2)
assert_true(nr2 < 3)
- if has('float')
- var ff = 2.0
- assert_false(ff < 0.0)
- assert_false(ff < 2.0)
- assert_true(ff < 3.0)
- endif
+ var ff = 2.0
+ assert_false(ff < 0.0)
+ assert_false(ff < 2.0)
+ assert_true(ff < 3.0)
END
v9.CheckDefAndScriptSuccess(lines)
enddef
@@ -1217,13 +1191,11 @@ def Test_expr4_smallerequal()
assert_false(nr2 <= 1)
assert_true(nr2 <= 2)
assert_true(nr2 <= 3)
- if has('float')
- var ff = 2.0
- assert_false(ff <= 0.0)
- assert_false(ff <= 1.0)
- assert_true(ff <= 2.0)
- assert_true(ff <= 3.0)
- endif
+ var ff = 2.0
+ assert_false(ff <= 0.0)
+ assert_false(ff <= 1.0)
+ assert_true(ff <= 2.0)
+ assert_true(ff <= 3.0)
END
v9.CheckDefAndScriptSuccess(lines)
enddef
@@ -1456,10 +1428,8 @@ func Test_expr4_fails()
call v9.CheckDefAndScriptFailure(["var x = v:none isnot v:null"], 'Cannot use "isnot" with special', 1)
call v9.CheckDefAndScriptFailure(["var x = 123 is 123"], 'Cannot use "is" with number', 1)
call v9.CheckDefAndScriptFailure(["var x = 123 isnot 123"], 'Cannot use "isnot" with number', 1)
- if has('float')
- call v9.CheckDefAndScriptFailure(["var x = 1.3 is 1.3"], 'Cannot use "is" with float', 1)
- call v9.CheckDefAndScriptFailure(["var x = 1.3 isnot 1.3"], 'Cannot use "isnot" with float', 1)
- endif
+ call v9.CheckDefAndScriptFailure(["var x = 1.3 is 1.3"], 'Cannot use "is" with float', 1)
+ call v9.CheckDefAndScriptFailure(["var x = 1.3 isnot 1.3"], 'Cannot use "isnot" with float', 1)
call v9.CheckDefAndScriptFailure(["var x = 0za1 > 0z34"], 'Cannot compare blob with blob', 1)
call v9.CheckDefAndScriptFailure(["var x = 0za1 >= 0z34"], 'Cannot compare blob with blob', 1)
@@ -1518,9 +1488,7 @@ def Test_expr6()
assert_equal('afalse', 'a' .. false)
assert_equal('anull', 'a' .. v:null)
assert_equal('av:none', 'a' .. v:none)
- if has('float')
- assert_equal('a0.123', 'a' .. 0.123)
- endif
+ assert_equal('a0.123', 'a' .. 0.123)
assert_equal(3, 1 + [2, 3, 4][0])
assert_equal(5, 2 + {key: 3}['key'])
@@ -1719,31 +1687,27 @@ def Test_expr6_vim9script_channel()
enddef
def Test_expr6_float()
- if !has('float')
- MissingFeature 'float'
- else
- var lines =<< trim END
- assert_equal(66.0, 60.0 + 6.0)
- assert_equal(66.0, 60.0 + 6)
- assert_equal(66.0, 60 +
- 6.0)
- assert_equal(5.1, g:afloat
- + 5)
- assert_equal(8.1, 8 + g:afloat)
- assert_equal(10.1, g:anint + g:afloat)
- assert_equal(10.1, g:afloat + g:anint)
-
- assert_equal(54.0, 60.0 - 6.0)
- assert_equal(54.0, 60.0
- - 6)
- assert_equal(54.0, 60 - 6.0)
- assert_equal(-4.9, g:afloat - 5)
- assert_equal(7.9, 8 - g:afloat)
- assert_equal(9.9, g:anint - g:afloat)
- assert_equal(-9.9, g:afloat - g:anint)
- END
- v9.CheckDefAndScriptSuccess(lines)
- endif
+ var lines =<< trim END
+ assert_equal(66.0, 60.0 + 6.0)
+ assert_equal(66.0, 60.0 + 6)
+ assert_equal(66.0, 60 +
+ 6.0)
+ assert_equal(5.1, g:afloat
+ + 5)
+ assert_equal(8.1, 8 + g:afloat)
+ assert_equal(10.1, g:anint + g:afloat)
+ assert_equal(10.1, g:afloat + g:anint)
+
+ assert_equal(54.0, 60.0 - 6.0)
+ assert_equal(54.0, 60.0
+ - 6)
+ assert_equal(54.0, 60 - 6.0)
+ assert_equal(-4.9, g:afloat - 5)
+ assert_equal(7.9, 8 - g:afloat)
+ assert_equal(9.9, g:anint - g:afloat)
+ assert_equal(-9.9, g:afloat - g:anint)
+ END
+ v9.CheckDefAndScriptSuccess(lines)
enddef
func Test_expr6_fails()
@@ -1852,14 +1816,12 @@ def Test_expr7()
var y = [3]
assert_equal(5, x[0] + y[0])
assert_equal(6, x[0] * y[0])
- if has('float')
- var xf = [2.0]
- var yf = [3.0]
- assert_equal(5.0, xf[0]
- + yf[0])
- assert_equal(6.0, xf[0]
- * yf[0])
- endif
+ var xf = [2.0]
+ var yf = [3.0]
+ assert_equal(5.0, xf[0]
+ + yf[0])
+ assert_equal(6.0, xf[0]
+ * yf[0])
END
v9.CheckDefAndScriptSuccess(lines)
@@ -1874,13 +1836,11 @@ def Test_expr7()
v9.CheckDefExecFailure(['echo 123 / g:zero'], 'E1154: Divide by zero')
v9.CheckDefExecFailure(['echo 123 % g:zero'], 'E1154: Divide by zero')
- if has('float')
- v9.CheckDefExecAndScriptFailure([
- 'g:one = 1.0',
- 'g:two = 2.0',
- 'echo g:one % g:two',
- ], 'E804', 3)
- endif
+ v9.CheckDefExecAndScriptFailure([
+ 'g:one = 1.0',
+ 'g:two = 2.0',
+ 'echo g:one % g:two',
+ ], 'E804', 3)
lines =<< trim END
var n = 0
@@ -1948,36 +1908,32 @@ def Test_expr7_vim9script()
enddef
def Test_expr7_float()
- if !has('float')
- MissingFeature 'float'
- else
- var lines =<< trim END
- assert_equal(36.0, 6.0 * 6)
- assert_equal(36.0, 6 *
- 6.0)
- assert_equal(36.0, 6.0 * 6.0)
- assert_equal(1.0, g:afloat * g:anint)
-
- assert_equal(10.0, 60 / 6.0)
- assert_equal(10.0, 60.0 /
- 6)
- assert_equal(10.0, 60.0 / 6.0)
- assert_equal(0.01, g:afloat / g:anint)
-
- assert_equal(4.0, 6.0 * 4 / 6)
- assert_equal(4.0, 6 *
- 4.0 /
- 6)
- assert_equal(4.0, 6 * 4 / 6.0)
- assert_equal(4.0, 6.0 * 4.0 / 6)
- assert_equal(4.0, 6 * 4.0 / 6.0)
- assert_equal(4.0, 6.0 * 4 / 6.0)
- assert_equal(4.0, 6.0 * 4.0 / 6.0)
-
- assert_equal(4.0, 6.0 * 4.0 / 6.0)
- END
- v9.CheckDefAndScriptSuccess(lines)
- endif
+ var lines =<< trim END
+ assert_equal(36.0, 6.0 * 6)
+ assert_equal(36.0, 6 *
+ 6.0)
+ assert_equal(36.0, 6.0 * 6.0)
+ assert_equal(1.0, g:afloat * g:anint)
+
+ assert_equal(10.0, 60 / 6.0)
+ assert_equal(10.0, 60.0 /
+ 6)
+ assert_equal(10.0, 60.0 / 6.0)
+ assert_equal(0.01, g:afloat / g:anint)
+
+ assert_equal(4.0, 6.0 * 4 / 6)
+ assert_equal(4.0, 6 *
+ 4.0 /
+ 6)
+ assert_equal(4.0, 6 * 4 / 6.0)
+ assert_equal(4.0, 6.0 * 4.0 / 6)
+ assert_equal(4.0, 6 * 4.0 / 6.0)
+ assert_equal(4.0, 6.0 * 4 / 6.0)
+ assert_equal(4.0, 6.0 * 4.0 / 6.0)
+
+ assert_equal(4.0, 6.0 * 4.0 / 6.0)
+ END
+ v9.CheckDefAndScriptSuccess(lines)
enddef
func Test_expr7_fails()
@@ -2013,9 +1969,7 @@ func Test_expr7_fails()
call v9.CheckDefAndScriptFailure(["var x = {one: 1} % {two: 2}"], ['E1035:', 'E728:'], 1)
call v9.CheckDefAndScriptFailure(["var x = 0xff[1]"], ['E1107:', 'E1062:'], 1)
- if has('float')
- call v9.CheckDefAndScriptFailure(["var x = 0.7[1]"], ['E1107:', 'E806:'], 1)
- endif
+ call v9.CheckDefAndScriptFailure(["var x = 0.7[1]"], ['E1107:', 'E806:'], 1)
for op in ['*', '/', '%']
let lines = ['var x = 1', op .. '2', '# comment']
@@ -2025,16 +1979,14 @@ func Test_expr7_fails()
endfunc
func Test_expr7_float_fails()
- CheckFeature float
call v9.CheckDefAndScriptFailure(["var x = 1.0 % 2"], ['E1035:', 'E804:'], 1)
endfunc
" define here to use old style parsing
-if has('float')
- let g:float_zero = 0.0
- let g:float_neg = -9.8
- let g:float_big = 9.9e99
-endif
+let g:float_zero = 0.0
+let g:float_neg = -9.8
+let g:float_big = 9.9e99
+
let g:blob_empty = 0z
let g:blob_one = 0z01
let g:blob_long = 0z0102.0304
@@ -2099,17 +2051,13 @@ enddef
def Test_expr9_float()
# float constant
- if !has('float')
- MissingFeature 'float'
- else
- var lines =<< trim END
- assert_equal(g:float_zero, .0)
- assert_equal(g:float_zero, 0.0)
- assert_equal(g:float_neg, -9.8)
- assert_equal(g:float_big, 9.9e99)
- END
- v9.CheckDefAndScriptSuccess(lines)
- endif
+ var lines =<< trim END
+ assert_equal(g:float_zero, .0)
+ assert_equal(g:float_zero, 0.0)
+ assert_equal(g:float_neg, -9.8)
+ assert_equal(g:float_big, 9.9e99)
+ END
+ v9.CheckDefAndScriptSuccess(lines)
enddef
def Test_expr9_blob()
@@ -2797,11 +2745,9 @@ def Test_expr9_dict()
assert_equal('numberexpr', dkeys[12])
assert_equal('number', dkeys[34])
assert_equal('bool', dkeys[true])
- if has('float')
- dkeys = {[1.2]: 'floatexpr', [3.4]: 'float'}
- assert_equal('floatexpr', dkeys[1.2])
- assert_equal('float', dkeys[3.4])
- endif
+ dkeys = {[1.2]: 'floatexpr', [3.4]: 'float'}
+ assert_equal('floatexpr', dkeys[1.2])
+ assert_equal('float', dkeys[3.4])
# automatic conversion from number to string
var n = 123
diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim
index 07dc59d15..641ef7368 100644
--- a/src/testdir/test_vimscript.vim
+++ b/src/testdir/test_vimscript.vim
@@ -6490,9 +6490,7 @@ func Test_type()
call assert_equal(2, type(function("tr", [8])))
call assert_equal(3, type([]))
call assert_equal(4, type({}))
- if has('float')
- call assert_equal(5, type(0.0))
- endif
+ call assert_equal(5, type(0.0))
call assert_equal(6, type(v:false))
call assert_equal(6, type(v:true))
call assert_equal(7, type(v:none))
@@ -6505,9 +6503,7 @@ func Test_type()
call assert_equal(v:t_func, type(function("tr", [8])))
call assert_equal(v:t_list, type([]))
call assert_equal(v:t_dict, type({}))
- if has('float')
- call assert_equal(v:t_float, type(0.0))
- endif
+ call assert_equal(v:t_float, type(0.0))
call assert_equal(v:t_bool, type(v:false))
call assert_equal(v:t_bool, type(v:true))
call assert_equal(v:t_none, type(v:none))
@@ -6551,11 +6547,9 @@ func Test_type()
call assert_true(v:none == 0)
call assert_false(v:none == 1)
call assert_false(v:none != 0)
- if has('float')
- call assert_true(v:null == 0.0)
- call assert_false(v:null == 0.1)
- call assert_false(v:null != 0.0)
- endif
+ call assert_true(v:null == 0.0)
+ call assert_false(v:null == 0.1)
+ call assert_false(v:null != 0.0)
call assert_true(v:false is v:false)
call assert_true(v:true is v:true)
@@ -6670,16 +6664,14 @@ func Test_echo_and_string()
\ "'foo bar'"], l)
" Float
- if has('float')
- let a = -1.2e0
- redir => result
- echo a
- echo string(a)
- redir END
- let l = split(result, "\n")
- call assert_equal(["-1.2",
- \ "-1.2"], l)
- endif
+ let a = -1.2e0
+ redir => result
+ echo a
+ echo string(a)
+ redir END
+ let l = split(result, "\n")
+ call assert_equal(["-1.2",
+ \ "-1.2"], l)
" Funcref
redir => result
@@ -6816,10 +6808,8 @@ func Test_num64()
call assert_equal(-9223372036854775807, -1 / 0)
call assert_equal(-9223372036854775807 - 1, 0 / 0)
- if has('float')
- call assert_equal( 0x7FFFffffFFFFffff, float2nr( 1.0e150))
- call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150))
- endif
+ call assert_equal( 0x7FFFffffFFFFffff, float2nr( 1.0e150))
+ call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150))
let rng = range(0xFFFFffff, 0x100000001)
call assert_equal([0xFFFFffff, 0x100000000, 0x100000001], rng)
@@ -6921,10 +6911,8 @@ func Test_bitwise_functions()
call assert_equal(0, and(127, 128))
call assert_fails("call and([], 1)", 'E745:')
call assert_fails("call and({}, 1)", 'E728:')
- if has('float')
- call assert_fails("call and(1.0, 1)", 'E805:')
- call assert_fails("call and(1, 1.0)", 'E805:')
- endif
+ call assert_fails("call and(1.0, 1)", 'E805:')
+ call assert_fails("call and(1, 1.0)", 'E805:')
call assert_fails("call and(1, [])", 'E745:')
call assert_fails("call and(1, {})", 'E728:')
" or
@@ -6934,10 +6922,8 @@ func Test_bitwise_functions()
call assert_equal(123, or(0, 123))
call assert_fails("call or([], 1)", 'E745:')
call assert_fails("call or({}, 1)", 'E728:')
- if has('float')
- call assert_fails("call or(1.0, 1)", 'E805:')
- call assert_fails("call or(1, 1.0)", 'E805:')
- endif
+ call assert_fails("call or(1.0, 1)", 'E805:')
+ call assert_fails("call or(1, 1.0)", 'E805:')
call assert_fails("call or(1, [])", 'E745:')
call assert_fails("call or(1, {})", 'E728:')
" xor
@@ -6945,10 +6931,8 @@ func Test_bitwise_functions()
call assert_equal(111, xor(127, 16))
eval 127->xor(16)->assert_equal(111)
call assert_equal(255, xor(127, 128))
- if has('float')
- call assert_fails("call xor(1.0, 1)", 'E805:')
- call assert_fails("call xor(1, 1.0)", 'E805:')
- endif
+ call assert_fails("call xor(1.0, 1)", 'E805:')
+ call assert_fails("call xor(1, 1.0)", 'E805:')
call assert_fails("call xor([], 1)", 'E745:')
call assert_fails("call xor({}, 1)", 'E728:')
call assert_fails("call xor(1, [])", 'E745:')
@@ -6958,9 +6942,7 @@ func Test_bitwise_functions()
eval 127->invert()->and(65535)->assert_equal(65408)
call assert_equal(65519, and(invert(16), 65535))
call assert_equal(65407, and(invert(128), 65535))
- if has('float')
- call assert_fails("call invert(1.0)", 'E805:')
- endif
+ call assert_fails("call invert(1.0)", 'E805:')
call assert_fails("call invert([])", 'E745:')
call assert_fails("call invert({})", 'E728:')
endfunc
@@ -7039,38 +7021,36 @@ func Test_compound_assignment_operators()
let x += 1
call assert_equal(1, x)
- if has('float')
- " Test for float
- let x -= 1.5
- call assert_equal(-0.5, x)
- let x = 0.5
- let x += 4.5
- call assert_equal(5.0, x)
- let x -= 1.5
- call assert_equal(3.5, x)
- let x *= 3.0
- call assert_equal(10.5, x)
- let x /= 2.5
- call assert_equal(4.2, x)
- call assert_fails('let x %= 0.5', 'E734:')
- call assert_fails('let x .= "f"', 'E734:')
- let x = !3.14
- call assert_equal(0.0, x)
-
- " integer and float operations
- let x = 1
- let x *= 2.1
- call assert_equal(2.1, x)
- let x = 1
- let x /= 0.25
- call assert_equal(4.0, x)
- let x = 1
- call assert_fails('let x %= 0.25', 'E734:')
- let x = 1
- call assert_fails('let x .= 0.25', 'E734:')
- let x = 1.0
- call assert_fails('let x += [1.1]', 'E734:')
- endif
+ " Test for float
+ let x -= 1.5
+ call assert_equal(-0.5, x)
+ let x = 0.5
+ let x += 4.5
+ call assert_equal(5.0, x)
+ let x -= 1.5
+ call assert_equal(3.5, x)
+ let x *= 3.0
+ call assert_equal(10.5, x)
+ let x /= 2.5
+ call assert_equal(4.2, x)
+ call assert_fails('let x %= 0.5', 'E734:')
+ call assert_fails('let x .= "f"', 'E734:')
+ let x = !3.14
+ call assert_equal(0.0, x)
+
+ " integer and float operations
+ let x = 1
+ let x *= 2.1
+ call assert_equal(2.1, x)
+ let x = 1
+ let x /= 0.25
+ call assert_equal(4.0, x)
+ let x = 1
+ call assert_fails('let x %= 0.25', 'E734:')
+ let x = 1
+ call assert_fails('let x .= 0.25', 'E734:')
+ let x = 1.0
+ call assert_fails('let x += [1.1]', 'E734:')
" Test for environment variable
let $FOO = 1
@@ -7142,9 +7122,7 @@ func Test_refcount()
call assert_equal(0, test_refcount({}))
call assert_equal(0, test_refcount(0zff))
call assert_equal(0, test_refcount({-> line('.')}))
- if has('float')
- call assert_equal(-1, test_refcount(0.1))
- endif
+ call assert_equal(-1, test_refcount(0.1))
if has('job')
call assert_equal(0, test_refcount(job_start([&shell, &shellcmdflag, 'echo .'])))
endif
@@ -7156,10 +7134,8 @@ func Test_refcount()
call assert_equal(-1, test_refcount(x))
let x = v:true
call assert_equal(-1, test_refcount(x))
- if has('float')
- let x = 0.1
- call assert_equal(-1, test_refcount(x))
- endif
+ let x = 0.1
+ call assert_equal(-1, test_refcount(x))
" Check refcount
let x = []
@@ -7377,16 +7353,14 @@ endfunc
" Test for errors in converting to float from various types {{{1
func Test_float_conversion_errors()
- if has('float')
- call assert_fails('let x = 4.0 % 2.0', 'E804:')
- call assert_fails('echo 1.1[0]', 'E806:')
- call assert_fails('echo sort([function("min"), 1], "f")', 'E891:')
- call assert_fails('echo 3.2 == "vim"', 'E892:')
- call assert_fails('echo sort([[], 1], "f")', 'E893:')
- call assert_fails('echo sort([{}, 1], "f")', 'E894:')
- call assert_fails('echo 3.2 == v:true', 'E362:')
- call assert_fails('echo 3.2 == v:none', 'E907:')
- endif
+ call assert_fails('let x = 4.0 % 2.0', 'E804:')
+ call assert_fails('echo 1.1[0]', 'E806:')
+ call assert_fails('echo sort([function("min"), 1], "f")', 'E891:')
+ call assert_fails('echo 3.2 == "vim"', 'E892:')
+ call assert_fails('echo sort([[], 1], "f")', 'E893:')
+ call assert_fails('echo sort([{}, 1], "f")', 'E894:')
+ call assert_fails('echo 3.2 == v:true', 'E362:')
+ call assert_fails('echo 3.2 == v:none', 'E907:')
endfunc
" invalid function names {{{1