aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-16 14:25:35 +0800
committerGitHub <noreply@github.com>2024-07-16 06:25:35 +0000
commit598fd77d952364d4dd3433425afe9798dac15206 (patch)
tree71e27a8278791ab97f95f0e382a2fbbcb41c7811
parent37c7c7547a09cb6fb391f739d08290b782429494 (diff)
downloadrneovim-598fd77d952364d4dd3433425afe9798dac15206.tar.gz
rneovim-598fd77d952364d4dd3433425afe9798dac15206.tar.bz2
rneovim-598fd77d952364d4dd3433425afe9798dac15206.zip
vim-patch:8.2.0183: tests fail when the float feature is disabled (#29738)
Problem: Tests fail when the float feature is disabled. Solution: Skip tests that don't work without float support. https://github.com/vim/vim/commit/5feabe00c47fa66d5f4c95213f150488433f78e3 Cherry-pick Test_ruby_Vim_blob() from patch 8.1.0977 and skip it. Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--test/old/testdir/test_lambda.vim4
-rw-r--r--test/old/testdir/test_ruby.vim8
-rw-r--r--test/old/testdir/test_sort.vim28
-rw-r--r--test/old/testdir/test_vimscript.vim32
4 files changed, 62 insertions, 10 deletions
diff --git a/test/old/testdir/test_lambda.vim b/test/old/testdir/test_lambda.vim
index 810b41b389..0340a7260b 100644
--- a/test/old/testdir/test_lambda.vim
+++ b/test/old/testdir/test_lambda.vim
@@ -217,7 +217,9 @@ endfunc
func Test_lambda_combination()
call assert_equal(2, {x -> {x -> x}}(1)(2))
call assert_equal(10, {y -> {x -> x(y)(10)}({y -> y})}({z -> z}))
- call assert_equal(5.0, {x -> {y -> x / y}}(10)(2.0))
+ if has('float')
+ call assert_equal(5.0, {x -> {y -> x / y}}(10)(2.0))
+ endif
call assert_equal(6, {x -> {y -> {z -> x + y + z}}}(1)(2)(3))
call assert_equal(6, {x -> {f -> f(x)}}(3)({x -> x * 2}))
diff --git a/test/old/testdir/test_ruby.vim b/test/old/testdir/test_ruby.vim
index 4929496086..483e235636 100644
--- a/test/old/testdir/test_ruby.vim
+++ b/test/old/testdir/test_ruby.vim
@@ -337,6 +337,14 @@ func Test_ruby_Vim_evaluate()
call assert_equal('FalseClass',rubyeval('Vim::evaluate("v:false").class'))
endfunc
+func Test_ruby_Vim_blob()
+ throw 'skipped: TODO: '
+ call assert_equal('0z', rubyeval('Vim::blob("")'))
+ call assert_equal('0z31326162', rubyeval('Vim::blob("12ab")'))
+ call assert_equal('0z00010203', rubyeval('Vim::blob("\x00\x01\x02\x03")'))
+ call assert_equal('0z8081FEFF', rubyeval('Vim::blob("\x80\x81\xfe\xff")'))
+endfunc
+
func Test_ruby_Vim_evaluate_list()
call setline(line('$'), ['2 line 2'])
ruby Vim.command("normal /^2\n")
diff --git a/test/old/testdir/test_sort.vim b/test/old/testdir/test_sort.vim
index 94a35e3cb5..dafa3f618f 100644
--- a/test/old/testdir/test_sort.vim
+++ b/test/old/testdir/test_sort.vim
@@ -1336,6 +1336,34 @@ 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
for t in tests
enew!
diff --git a/test/old/testdir/test_vimscript.vim b/test/old/testdir/test_vimscript.vim
index 1012aca54d..28868a07d6 100644
--- a/test/old/testdir/test_vimscript.vim
+++ b/test/old/testdir/test_vimscript.vim
@@ -6502,16 +6502,22 @@ func Test_type()
call assert_equal(2, type(function("tr", [8])))
call assert_equal(3, type([]))
call assert_equal(4, type({}))
- call assert_equal(5, type(0.0))
+ if has('float')
+ call assert_equal(5, type(0.0))
+ endif
call assert_equal(6, type(v:false))
call assert_equal(6, type(v:true))
+ " call assert_equal(7, type(v:none))
call assert_equal(7, type(v:null))
call assert_equal(v:t_number, type(0))
call assert_equal(v:t_string, type(""))
call assert_equal(v:t_func, type(function("tr")))
+ call assert_equal(v:t_func, type(function("tr", [8])))
call assert_equal(v:t_list, type([]))
call assert_equal(v:t_dict, type({}))
- call assert_equal(v:t_float, type(0.0))
+ if has('float')
+ call assert_equal(v:t_float, type(0.0))
+ endif
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))
@@ -6829,10 +6835,12 @@ func Test_bitwise_functions()
call assert_equal(16, and(127, 16))
eval 127->and(16)->assert_equal(16)
call assert_equal(0, and(127, 128))
- call assert_fails("call and(1.0, 1)", 'E805:')
call assert_fails("call and([], 1)", 'E745:')
call assert_fails("call and({}, 1)", 'E728:')
- call assert_fails("call and(1, 1.0)", 'E805:')
+ 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, [])", 'E745:')
call assert_fails("call and(1, {})", 'E728:')
" or
@@ -6840,10 +6848,12 @@ func Test_bitwise_functions()
call assert_equal(15, or(8, 7))
eval 8->or(7)->assert_equal(15)
call assert_equal(123, or(0, 123))
- call assert_fails("call or(1.0, 1)", 'E805:')
call assert_fails("call or([], 1)", 'E745:')
call assert_fails("call or({}, 1)", 'E728:')
- call assert_fails("call or(1, 1.0)", 'E805:')
+ 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, [])", 'E745:')
call assert_fails("call or(1, {})", 'E728:')
" xor
@@ -6851,10 +6861,12 @@ 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))
- call assert_fails("call xor(1.0, 1)", 'E805:')
+ 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)", 'E745:')
call assert_fails("call xor({}, 1)", 'E728:')
- call assert_fails("call xor(1, 1.0)", 'E805:')
call assert_fails("call xor(1, [])", 'E745:')
call assert_fails("call xor(1, {})", 'E728:')
" invert
@@ -6862,7 +6874,9 @@ 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))
- call assert_fails("call invert(1.0)", 'E805:')
+ if has('float')
+ call assert_fails("call invert(1.0)", 'E805:')
+ endif
call assert_fails("call invert([])", 'E745:')
call assert_fails("call invert({})", 'E728:')
endfunc