mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.2.0183: tests fail when the float feature is disabled
Problem: Tests fail when the float feature is disabled. Solution: Skip tests that don't work without float support.
This commit is contained in:
@@ -156,7 +156,7 @@ endfunc
|
|||||||
func s:WaitForCommon(expr, assert, timeout)
|
func s:WaitForCommon(expr, assert, timeout)
|
||||||
" using reltime() is more accurate, but not always available
|
" using reltime() is more accurate, but not always available
|
||||||
let slept = 0
|
let slept = 0
|
||||||
if has('reltime')
|
if exists('*reltimefloat')
|
||||||
let start = reltime()
|
let start = reltime()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ func s:WaitForCommon(expr, assert, timeout)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
sleep 10m
|
sleep 10m
|
||||||
if has('reltime')
|
if exists('*reltimefloat')
|
||||||
let slept = float2nr(reltimefloat(reltime(start)) * 1000)
|
let slept = float2nr(reltimefloat(reltime(start)) * 1000)
|
||||||
else
|
else
|
||||||
let slept += 10
|
let slept += 10
|
||||||
@@ -197,7 +197,7 @@ endfunc
|
|||||||
" feeds key-input and resumes process. Return time waited in milliseconds.
|
" feeds key-input and resumes process. Return time waited in milliseconds.
|
||||||
" Without +timers it uses simply :sleep.
|
" Without +timers it uses simply :sleep.
|
||||||
func Standby(msec)
|
func Standby(msec)
|
||||||
if has('timers')
|
if has('timers') && exists('*reltimefloat')
|
||||||
let start = reltime()
|
let start = reltime()
|
||||||
let g:_standby_timer = timer_start(a:msec, function('s:feedkeys'))
|
let g:_standby_timer = timer_start(a:msec, function('s:feedkeys'))
|
||||||
call getchar()
|
call getchar()
|
||||||
|
@@ -324,5 +324,5 @@ func Test_blob_lock()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_blob_sort()
|
func Test_blob_sort()
|
||||||
call assert_fails('call sort([1.0, 0z11], "f")', 'E975:')
|
call assert_fails('call sort(["abc", 0z11], "f")', 'E702:')
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -202,10 +202,12 @@ func Ch_communicate(port)
|
|||||||
|
|
||||||
" Reading while there is nothing available.
|
" Reading while there is nothing available.
|
||||||
call assert_equal(v:none, ch_read(handle, {'timeout': 0}))
|
call assert_equal(v:none, ch_read(handle, {'timeout': 0}))
|
||||||
|
if exists('*reltimefloat')
|
||||||
let start = reltime()
|
let start = reltime()
|
||||||
call assert_equal(v:none, ch_read(handle, {'timeout': 333}))
|
call assert_equal(v:none, ch_read(handle, {'timeout': 333}))
|
||||||
let elapsed = reltime(start)
|
let elapsed = reltime(start)
|
||||||
call assert_inrange(0.3, 0.6, reltimefloat(reltime(start)))
|
call assert_inrange(0.3, 0.6, reltimefloat(reltime(start)))
|
||||||
|
endif
|
||||||
|
|
||||||
" Send without waiting for a response, then wait for a response.
|
" Send without waiting for a response, then wait for a response.
|
||||||
call ch_sendexpr(handle, 'wait a bit')
|
call ch_sendexpr(handle, 'wait a bit')
|
||||||
@@ -412,6 +414,8 @@ endfunc
|
|||||||
|
|
||||||
" Test that trying to connect to a non-existing port fails quickly.
|
" Test that trying to connect to a non-existing port fails quickly.
|
||||||
func Test_connect_waittime()
|
func Test_connect_waittime()
|
||||||
|
CheckFunction reltimefloat
|
||||||
|
|
||||||
call ch_log('Test_connect_waittime()')
|
call ch_log('Test_connect_waittime()')
|
||||||
let start = reltime()
|
let start = reltime()
|
||||||
let handle = ch_open('localhost:9876', s:chopt)
|
let handle = ch_open('localhost:9876', s:chopt)
|
||||||
@@ -927,6 +931,8 @@ func Test_pipe_to_nameless_buffer()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_pipe_to_buffer_json()
|
func Test_pipe_to_buffer_json()
|
||||||
|
CheckFunction reltimefloat
|
||||||
|
|
||||||
let job = job_start(s:python . " test_channel_pipe.py",
|
let job = job_start(s:python . " test_channel_pipe.py",
|
||||||
\ {'out_io': 'buffer', 'out_mode': 'json'})
|
\ {'out_io': 'buffer', 'out_mode': 'json'})
|
||||||
call assert_equal("run", job_status(job))
|
call assert_equal("run", job_status(job))
|
||||||
@@ -1423,6 +1429,8 @@ function MyExitTimeCb(job, status)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
func Test_exit_callback_interval()
|
func Test_exit_callback_interval()
|
||||||
|
CheckFunction reltimefloat
|
||||||
|
|
||||||
let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0}
|
let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0}
|
||||||
let job = [s:python, '-c', 'import time;time.sleep(0.5)']->job_start({'exit_cb': 'MyExitTimeCb'})
|
let job = [s:python, '-c', 'import time;time.sleep(0.5)']->job_start({'exit_cb': 'MyExitTimeCb'})
|
||||||
let g:exit_cb_val.process = job_info(job).process
|
let g:exit_cb_val.process = job_info(job).process
|
||||||
@@ -1768,6 +1776,7 @@ endfunc
|
|||||||
|
|
||||||
func Test_job_start_in_timer()
|
func Test_job_start_in_timer()
|
||||||
CheckFeature timers
|
CheckFeature timers
|
||||||
|
CheckFeature reltimefloat
|
||||||
|
|
||||||
func OutCb(chan, msg)
|
func OutCb(chan, msg)
|
||||||
let g:val += 1
|
let g:val += 1
|
||||||
|
@@ -116,6 +116,7 @@ func Test_cscopeWithCscopeConnections()
|
|||||||
" Test 10: Invalid find command
|
" Test 10: Invalid find command
|
||||||
call assert_fails('cs find x', 'E560:')
|
call assert_fails('cs find x', 'E560:')
|
||||||
|
|
||||||
|
if has('float')
|
||||||
" Test 11: Find places where this symbol is assigned a value
|
" Test 11: Find places where this symbol is assigned a value
|
||||||
" this needs a cscope >= 15.8
|
" this needs a cscope >= 15.8
|
||||||
" unfortunately, Travis has cscope version 15.7
|
" unfortunately, Travis has cscope version 15.7
|
||||||
@@ -134,6 +135,7 @@ func Test_cscopeWithCscopeConnections()
|
|||||||
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
|
call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" Test 12: leading whitespace is not removed for cscope find text
|
" Test 12: leading whitespace is not removed for cscope find text
|
||||||
let a = execute('cscope find t test_mf_hash')
|
let a = execute('cscope find t test_mf_hash')
|
||||||
|
@@ -30,14 +30,16 @@ func Test_execute_string()
|
|||||||
call assert_equal("\nthat", evaled)
|
call assert_equal("\nthat", evaled)
|
||||||
|
|
||||||
call assert_fails('call execute("doesnotexist")', 'E492:')
|
call assert_fails('call execute("doesnotexist")', 'E492:')
|
||||||
call assert_fails('call execute(3.4)', 'E806:')
|
|
||||||
call assert_fails('call execute("call NestedRedir()")', 'E930:')
|
call assert_fails('call execute("call NestedRedir()")', 'E930:')
|
||||||
|
|
||||||
call assert_equal("\nsomething", execute('echo "something"', ''))
|
call assert_equal("\nsomething", execute('echo "something"', ''))
|
||||||
call assert_equal("\nsomething", execute('echo "something"', 'silent'))
|
call assert_equal("\nsomething", execute('echo "something"', 'silent'))
|
||||||
call assert_equal("\nsomething", execute('echo "something"', 'silent!'))
|
call assert_equal("\nsomething", execute('echo "something"', 'silent!'))
|
||||||
call assert_equal("", execute('burp', 'silent!'))
|
call assert_equal("", execute('burp', 'silent!'))
|
||||||
|
if has('float')
|
||||||
|
call assert_fails('call execute(3.4)', 'E806:')
|
||||||
call assert_fails('call execute("echo \"x\"", 3.4)', 'E806:')
|
call assert_fails('call execute("echo \"x\"", 3.4)', 'E806:')
|
||||||
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_execute_list()
|
func Test_execute_list()
|
||||||
|
@@ -369,7 +369,9 @@ function Test_printf_errors()
|
|||||||
call assert_fails('echo printf("%d", [])', 'E745:')
|
call assert_fails('echo printf("%d", [])', 'E745:')
|
||||||
call assert_fails('echo printf("%d", 1, 2)', 'E767:')
|
call assert_fails('echo printf("%d", 1, 2)', 'E767:')
|
||||||
call assert_fails('echo printf("%*d", 1)', 'E766:')
|
call assert_fails('echo printf("%*d", 1)', 'E766:')
|
||||||
|
if has('float')
|
||||||
call assert_fails('echo printf("%d", 1.2)', 'E805:')
|
call assert_fails('echo printf("%d", 1.2)', 'E805:')
|
||||||
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function Test_max_min_errors()
|
function Test_max_min_errors()
|
||||||
|
@@ -28,12 +28,14 @@ func Test_empty()
|
|||||||
call assert_equal(0, empty(1))
|
call assert_equal(0, empty(1))
|
||||||
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(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))
|
call assert_equal(0, empty(-1.0))
|
||||||
call assert_equal(0, empty(1.0/0.0))
|
call assert_equal(0, empty(1.0/0.0))
|
||||||
call assert_equal(0, empty(0.0/0.0))
|
call assert_equal(0, empty(0.0/0.0))
|
||||||
|
endif
|
||||||
|
|
||||||
call assert_equal(1, empty([]))
|
call assert_equal(1, empty([]))
|
||||||
call assert_equal(0, empty(['a']))
|
call assert_equal(0, empty(['a']))
|
||||||
@@ -116,7 +118,9 @@ func Test_strwidth()
|
|||||||
call assert_fails('call strwidth({->0})', 'E729:')
|
call assert_fails('call strwidth({->0})', 'E729:')
|
||||||
call assert_fails('call strwidth([])', 'E730:')
|
call assert_fails('call strwidth([])', 'E730:')
|
||||||
call assert_fails('call strwidth({})', 'E731:')
|
call assert_fails('call strwidth({})', 'E731:')
|
||||||
|
if has('float')
|
||||||
call assert_fails('call strwidth(1.2)', 'E806:')
|
call assert_fails('call strwidth(1.2)', 'E806:')
|
||||||
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
set ambiwidth&
|
set ambiwidth&
|
||||||
@@ -176,7 +180,9 @@ func Test_str2nr()
|
|||||||
|
|
||||||
call assert_fails('call str2nr([])', 'E730:')
|
call assert_fails('call str2nr([])', 'E730:')
|
||||||
call assert_fails('call str2nr({->2})', 'E729:')
|
call assert_fails('call str2nr({->2})', 'E729:')
|
||||||
|
if has('float')
|
||||||
call assert_fails('call str2nr(1.2)', 'E806:')
|
call assert_fails('call str2nr(1.2)', 'E806:')
|
||||||
|
endif
|
||||||
call assert_fails('call str2nr(10, [])', 'E474:')
|
call assert_fails('call str2nr(10, [])', 'E474:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -422,7 +428,9 @@ func Test_simplify()
|
|||||||
call assert_fails('call simplify({->0})', 'E729:')
|
call assert_fails('call simplify({->0})', 'E729:')
|
||||||
call assert_fails('call simplify([])', 'E730:')
|
call assert_fails('call simplify([])', 'E730:')
|
||||||
call assert_fails('call simplify({})', 'E731:')
|
call assert_fails('call simplify({})', 'E731:')
|
||||||
|
if has('float')
|
||||||
call assert_fails('call simplify(1.2)', 'E806:')
|
call assert_fails('call simplify(1.2)', 'E806:')
|
||||||
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_pathshorten()
|
func Test_pathshorten()
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
" Test glob2regpat()
|
" Test glob2regpat()
|
||||||
|
|
||||||
func Test_glob2regpat_invalid()
|
func Test_glob2regpat_invalid()
|
||||||
|
if has('float')
|
||||||
call assert_fails('call glob2regpat(1.33)', 'E806:')
|
call assert_fails('call glob2regpat(1.33)', 'E806:')
|
||||||
|
endif
|
||||||
call assert_fails('call glob2regpat("}")', 'E219:')
|
call assert_fails('call glob2regpat("}")', 'E219:')
|
||||||
call assert_fails('call glob2regpat("{")', 'E220:')
|
call assert_fails('call glob2regpat("{")', 'E220:')
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -216,7 +216,9 @@ endfunc
|
|||||||
func Test_lambda_combination()
|
func Test_lambda_combination()
|
||||||
call assert_equal(2, {x -> {x -> x}}(1)(2))
|
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(10, {y -> {x -> x(y)(10)}({y -> y})}({z -> z}))
|
||||||
|
if has('float')
|
||||||
call assert_equal(5.0, {x -> {y -> x / y}}(10)(2.0))
|
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 -> {y -> {z -> x + y + z}}}(1)(2)(3))
|
||||||
|
|
||||||
call assert_equal(6, {x -> {f -> f(x)}}(3)({x -> x * 2}))
|
call assert_equal(6, {x -> {f -> f(x)}}(3)({x -> x * 2}))
|
||||||
|
@@ -596,18 +596,20 @@ 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(['-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(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)))
|
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', '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, 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', '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)))
|
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']
|
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'))
|
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', {}, []]
|
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), 1))
|
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), 1))
|
||||||
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)))
|
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_fails('call reverse("")', 'E899:')
|
call assert_fails('call reverse("")', 'E899:')
|
||||||
endfunc
|
endfunc
|
||||||
@@ -683,7 +685,9 @@ func Test_listdict_extend()
|
|||||||
let l = [1, 2, 3]
|
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:')
|
||||||
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:')
|
call assert_fails("call extend(l, [4, 5, 6], 1.2)", 'E805:')
|
||||||
|
endif
|
||||||
|
|
||||||
" Test extend() with dictionaries.
|
" Test extend() with dictionaries.
|
||||||
|
|
||||||
@@ -707,7 +711,9 @@ func Test_listdict_extend()
|
|||||||
let d = {'a': 'A', 'b': 'B'}
|
let d = {'a': 'A', 'b': 'B'}
|
||||||
call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'error')", 'E737:')
|
call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'error')", 'E737:')
|
||||||
call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'xxx')", 'E475:')
|
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)", 'E806:')
|
call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 1.2)", 'E806:')
|
||||||
|
endif
|
||||||
call assert_equal({'a': 'A', 'b': 'B'}, d)
|
call assert_equal({'a': 'A', 'b': 'B'}, d)
|
||||||
|
|
||||||
call assert_fails("call extend([1, 2], 1)", 'E712:')
|
call assert_fails("call extend([1, 2], 1)", 'E712:')
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
source check.vim
|
source check.vim
|
||||||
CheckFeature lua
|
CheckFeature lua
|
||||||
|
CheckFeature float
|
||||||
|
|
||||||
func TearDown()
|
func TearDown()
|
||||||
" Run garbage collection after each test to exercise luaV_setref().
|
" Run garbage collection after each test to exercise luaV_setref().
|
||||||
@@ -9,7 +10,7 @@ func TearDown()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Check that switching to another buffer does not trigger ml_get error.
|
" Check that switching to another buffer does not trigger ml_get error.
|
||||||
func Test_command_new_no_ml_get_error()
|
func Test_lua_command_new_no_ml_get_error()
|
||||||
new
|
new
|
||||||
let wincount = winnr('$')
|
let wincount = winnr('$')
|
||||||
call setline(1, ['one', 'two', 'three'])
|
call setline(1, ['one', 'two', 'three'])
|
||||||
@@ -19,7 +20,7 @@ func Test_command_new_no_ml_get_error()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.command()
|
" Test vim.command()
|
||||||
func Test_command()
|
func Test_lua_command()
|
||||||
new
|
new
|
||||||
call setline(1, ['one', 'two', 'three'])
|
call setline(1, ['one', 'two', 'three'])
|
||||||
luado vim.command("1,2d_")
|
luado vim.command("1,2d_")
|
||||||
@@ -28,7 +29,7 @@ func Test_command()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.eval()
|
" Test vim.eval()
|
||||||
func Test_eval()
|
func Test_lua_eval()
|
||||||
" lua.eval with a number
|
" lua.eval with a number
|
||||||
lua v = vim.eval('123')
|
lua v = vim.eval('123')
|
||||||
call assert_equal('number', luaeval('vim.type(v)'))
|
call assert_equal('number', luaeval('vim.type(v)'))
|
||||||
@@ -69,7 +70,7 @@ func Test_eval()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.window()
|
" Test vim.window()
|
||||||
func Test_window()
|
func Test_lua_window()
|
||||||
e Xfoo2
|
e Xfoo2
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ func Test_window()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.window().height
|
" Test vim.window().height
|
||||||
func Test_window_height()
|
func Test_lua_window_height()
|
||||||
new
|
new
|
||||||
lua vim.window().height = 2
|
lua vim.window().height = 2
|
||||||
call assert_equal(2, winheight(0))
|
call assert_equal(2, winheight(0))
|
||||||
@@ -95,7 +96,7 @@ func Test_window_height()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.window().width
|
" Test vim.window().width
|
||||||
func Test_window_width()
|
func Test_lua_window_width()
|
||||||
vert new
|
vert new
|
||||||
lua vim.window().width = 2
|
lua vim.window().width = 2
|
||||||
call assert_equal(2, winwidth(0))
|
call assert_equal(2, winwidth(0))
|
||||||
@@ -105,7 +106,7 @@ func Test_window_width()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.window().line and vim.window.col
|
" Test vim.window().line and vim.window.col
|
||||||
func Test_window_line_col()
|
func Test_lua_window_line_col()
|
||||||
new
|
new
|
||||||
call setline(1, ['line1', 'line2', 'line3'])
|
call setline(1, ['line1', 'line2', 'line3'])
|
||||||
lua vim.window().line = 2
|
lua vim.window().line = 2
|
||||||
@@ -121,7 +122,7 @@ func Test_window_line_col()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test setting the current window
|
" Test setting the current window
|
||||||
func Test_window_set_current()
|
func Test_lua_window_set_current()
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
lua w1 = vim.window()
|
lua w1 = vim.window()
|
||||||
new Xfoo2
|
new Xfoo2
|
||||||
@@ -138,7 +139,7 @@ func Test_window_set_current()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.window().buffer
|
" Test vim.window().buffer
|
||||||
func Test_window_buffer()
|
func Test_lua_window_buffer()
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
lua w1 = vim.window()
|
lua w1 = vim.window()
|
||||||
lua b1 = w1.buffer()
|
lua b1 = w1.buffer()
|
||||||
@@ -156,7 +157,7 @@ func Test_window_buffer()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.window():previous() and vim.window():next()
|
" Test vim.window():previous() and vim.window():next()
|
||||||
func Test_window_next_previous()
|
func Test_lua_window_next_previous()
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
new Xfoo2
|
new Xfoo2
|
||||||
new Xfoo3
|
new Xfoo3
|
||||||
@@ -170,7 +171,7 @@ func Test_window_next_previous()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.window():isvalid()
|
" Test vim.window():isvalid()
|
||||||
func Test_window_isvalid()
|
func Test_lua_window_isvalid()
|
||||||
new Xfoo
|
new Xfoo
|
||||||
lua w = vim.window()
|
lua w = vim.window()
|
||||||
call assert_true(luaeval('w:isvalid()'))
|
call assert_true(luaeval('w:isvalid()'))
|
||||||
@@ -183,7 +184,7 @@ func Test_window_isvalid()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.buffer() with and without argument
|
" Test vim.buffer() with and without argument
|
||||||
func Test_buffer()
|
func Test_lua_buffer()
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
let bn1 = bufnr('%')
|
let bn1 = bufnr('%')
|
||||||
new Xfoo2
|
new Xfoo2
|
||||||
@@ -205,7 +206,7 @@ func Test_buffer()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.buffer().name and vim.buffer().fname
|
" Test vim.buffer().name and vim.buffer().fname
|
||||||
func Test_buffer_name()
|
func Test_lua_buffer_name()
|
||||||
new
|
new
|
||||||
call assert_equal('', luaeval('vim.buffer().name'))
|
call assert_equal('', luaeval('vim.buffer().name'))
|
||||||
call assert_equal('', luaeval('vim.buffer().fname'))
|
call assert_equal('', luaeval('vim.buffer().fname'))
|
||||||
@@ -218,13 +219,13 @@ func Test_buffer_name()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.buffer().number
|
" Test vim.buffer().number
|
||||||
func Test_buffer_number()
|
func Test_lua_buffer_number()
|
||||||
" All numbers in Lua are floating points number (no integers).
|
" All numbers in Lua are floating points number (no integers).
|
||||||
call assert_equal(bufnr('%'), float2nr(luaeval('vim.buffer().number')))
|
call assert_equal(bufnr('%'), float2nr(luaeval('vim.buffer().number')))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test inserting lines in buffer.
|
" Test inserting lines in buffer.
|
||||||
func Test_buffer_insert()
|
func Test_lua_buffer_insert()
|
||||||
new
|
new
|
||||||
lua vim.buffer()[1] = '3'
|
lua vim.buffer()[1] = '3'
|
||||||
lua vim.buffer():insert('1', 0)
|
lua vim.buffer():insert('1', 0)
|
||||||
@@ -236,7 +237,7 @@ func Test_buffer_insert()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test deleting line in buffer
|
" Test deleting line in buffer
|
||||||
func Test_buffer_delete()
|
func Test_lua_buffer_delete()
|
||||||
new
|
new
|
||||||
call setline(1, ['1', '2', '3'])
|
call setline(1, ['1', '2', '3'])
|
||||||
lua vim.buffer()[2] = nil
|
lua vim.buffer()[2] = nil
|
||||||
@@ -248,7 +249,7 @@ func Test_buffer_delete()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test #vim.buffer() i.e. number of lines in buffer
|
" Test #vim.buffer() i.e. number of lines in buffer
|
||||||
func Test_buffer_number_lines()
|
func Test_lua_buffer_number_lines()
|
||||||
new
|
new
|
||||||
call setline(1, ['a', 'b', 'c'])
|
call setline(1, ['a', 'b', 'c'])
|
||||||
call assert_equal(3.0, luaeval('#vim.buffer()'))
|
call assert_equal(3.0, luaeval('#vim.buffer()'))
|
||||||
@@ -258,7 +259,7 @@ endfunc
|
|||||||
" Test vim.buffer():next() and vim.buffer():previous()
|
" Test vim.buffer():next() and vim.buffer():previous()
|
||||||
" Note that these functions get the next or previous buffers
|
" Note that these functions get the next or previous buffers
|
||||||
" but do not switch buffer.
|
" but do not switch buffer.
|
||||||
func Test_buffer_next_previous()
|
func Test_lua_buffer_next_previous()
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
new Xfoo2
|
new Xfoo2
|
||||||
new Xfoo3
|
new Xfoo3
|
||||||
@@ -286,7 +287,7 @@ func Test_buffer_next_previous()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.buffer():isvalid()
|
" Test vim.buffer():isvalid()
|
||||||
func Test_buffer_isvalid()
|
func Test_lua_buffer_isvalid()
|
||||||
new Xfoo
|
new Xfoo
|
||||||
lua b = vim.buffer()
|
lua b = vim.buffer()
|
||||||
call assert_true(luaeval('b:isvalid()'))
|
call assert_true(luaeval('b:isvalid()'))
|
||||||
@@ -298,7 +299,7 @@ func Test_buffer_isvalid()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_list()
|
func Test_lua_list()
|
||||||
call assert_equal([], luaeval('vim.list()'))
|
call assert_equal([], luaeval('vim.list()'))
|
||||||
|
|
||||||
let l = []
|
let l = []
|
||||||
@@ -326,7 +327,7 @@ func Test_list()
|
|||||||
lua l = nil
|
lua l = nil
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_list_table()
|
func Test_lua_list_table()
|
||||||
" See :help lua-vim
|
" See :help lua-vim
|
||||||
" Non-numeric keys should not be used to initialize the list
|
" Non-numeric keys should not be used to initialize the list
|
||||||
" so say = 'hi' should be ignored.
|
" so say = 'hi' should be ignored.
|
||||||
@@ -341,7 +342,7 @@ func Test_list_table()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test l() i.e. iterator on list
|
" Test l() i.e. iterator on list
|
||||||
func Test_list_iter()
|
func Test_lua_list_iter()
|
||||||
lua l = vim.list():add('foo'):add('bar')
|
lua l = vim.list():add('foo'):add('bar')
|
||||||
lua str = ''
|
lua str = ''
|
||||||
lua for v in l() do str = str .. v end
|
lua for v in l() do str = str .. v end
|
||||||
@@ -350,7 +351,7 @@ func Test_list_iter()
|
|||||||
lua str, l = nil
|
lua str, l = nil
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_recursive_list()
|
func Test_lua_recursive_list()
|
||||||
lua l = vim.list():add(1):add(2)
|
lua l = vim.list():add(1):add(2)
|
||||||
lua l = l:add(l)
|
lua l = l:add(l)
|
||||||
|
|
||||||
@@ -374,7 +375,7 @@ func Test_recursive_list()
|
|||||||
lua l = nil
|
lua l = nil
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_dict()
|
func Test_lua_dict()
|
||||||
call assert_equal({}, luaeval('vim.dict()'))
|
call assert_equal({}, luaeval('vim.dict()'))
|
||||||
|
|
||||||
let d = {}
|
let d = {}
|
||||||
@@ -401,7 +402,7 @@ func Test_dict()
|
|||||||
lua d = nil
|
lua d = nil
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_dict_table()
|
func Test_lua_dict_table()
|
||||||
lua t = {key1 = 'x', key2 = 3.14, key3 = true, key4 = false}
|
lua t = {key1 = 'x', key2 = 3.14, key3 = true, key4 = false}
|
||||||
call assert_equal({'key1': 'x', 'key2': 3.14, 'key3': v:true, 'key4': v:false},
|
call assert_equal({'key1': 'x', 'key2': 3.14, 'key3': v:true, 'key4': v:false},
|
||||||
\ luaeval('vim.dict(t)'))
|
\ luaeval('vim.dict(t)'))
|
||||||
@@ -422,7 +423,7 @@ func Test_dict_table()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test d() i.e. iterator on dictionary
|
" Test d() i.e. iterator on dictionary
|
||||||
func Test_dict_iter()
|
func Test_lua_dict_iter()
|
||||||
let d = {'a': 1, 'b':2}
|
let d = {'a': 1, 'b':2}
|
||||||
lua d = vim.eval('d')
|
lua d = vim.eval('d')
|
||||||
lua str = ''
|
lua str = ''
|
||||||
@@ -432,7 +433,7 @@ func Test_dict_iter()
|
|||||||
lua str, d = nil
|
lua str, d = nil
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_blob()
|
func Test_lua_blob()
|
||||||
call assert_equal(0z, luaeval('vim.blob("")'))
|
call assert_equal(0z, luaeval('vim.blob("")'))
|
||||||
call assert_equal(0z31326162, luaeval('vim.blob("12ab")'))
|
call assert_equal(0z31326162, luaeval('vim.blob("12ab")'))
|
||||||
call assert_equal(0z00010203, luaeval('vim.blob("\x00\x01\x02\x03")'))
|
call assert_equal(0z00010203, luaeval('vim.blob("\x00\x01\x02\x03")'))
|
||||||
@@ -456,7 +457,7 @@ func Test_blob()
|
|||||||
lua b = nil
|
lua b = nil
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_funcref()
|
func Test_lua_funcref()
|
||||||
function I(x)
|
function I(x)
|
||||||
return a:x
|
return a:x
|
||||||
endfunction
|
endfunction
|
||||||
@@ -483,7 +484,7 @@ func Test_funcref()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.type()
|
" Test vim.type()
|
||||||
func Test_type()
|
func Test_lua_type()
|
||||||
" The following values are identical to Lua's type function.
|
" The following values are identical to Lua's type function.
|
||||||
call assert_equal('string', luaeval('vim.type("foo")'))
|
call assert_equal('string', luaeval('vim.type("foo")'))
|
||||||
call assert_equal('number', luaeval('vim.type(1)'))
|
call assert_equal('number', luaeval('vim.type(1)'))
|
||||||
@@ -503,7 +504,7 @@ func Test_type()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.open()
|
" Test vim.open()
|
||||||
func Test_open()
|
func Test_lua_open()
|
||||||
call assert_notmatch('XOpen', execute('ls'))
|
call assert_notmatch('XOpen', execute('ls'))
|
||||||
|
|
||||||
" Open a buffer XOpen1, but do not jump to it.
|
" Open a buffer XOpen1, but do not jump to it.
|
||||||
@@ -524,7 +525,7 @@ func Test_open()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.line()
|
" Test vim.line()
|
||||||
func Test_line()
|
func Test_lua_line()
|
||||||
new
|
new
|
||||||
call setline(1, ['first line', 'second line'])
|
call setline(1, ['first line', 'second line'])
|
||||||
1
|
1
|
||||||
@@ -535,7 +536,7 @@ func Test_line()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test vim.beep()
|
" Test vim.beep()
|
||||||
func Test_beep()
|
func Test_lua_beep()
|
||||||
call assert_beeps('lua vim.beep()')
|
call assert_beeps('lua vim.beep()')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -591,7 +592,7 @@ func Test_luafile_error()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_cursor()
|
func Test_lua_set_cursor()
|
||||||
" Check that setting the cursor position works.
|
" Check that setting the cursor position works.
|
||||||
new
|
new
|
||||||
call setline(1, ['first line', 'second line'])
|
call setline(1, ['first line', 'second line'])
|
||||||
|
@@ -615,9 +615,8 @@ func Test_local_scrolloff()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_writedelay()
|
func Test_writedelay()
|
||||||
if !has('reltime')
|
CheckFunction reltimefloat
|
||||||
return
|
|
||||||
endif
|
|
||||||
new
|
new
|
||||||
call setline(1, 'empty')
|
call setline(1, 'empty')
|
||||||
redraw
|
redraw
|
||||||
|
@@ -106,7 +106,7 @@ fun InnerCall(funcref)
|
|||||||
endfu
|
endfu
|
||||||
|
|
||||||
fun OuterCall()
|
fun OuterCall()
|
||||||
let opt = { 'func' : function('sin') }
|
let opt = { 'func' : function('max') }
|
||||||
call InnerCall(opt.func)
|
call InnerCall(opt.func)
|
||||||
endfu
|
endfu
|
||||||
|
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
set encoding=latin1
|
set encoding=latin1
|
||||||
scriptencoding latin1
|
scriptencoding latin1
|
||||||
|
|
||||||
|
source check.vim
|
||||||
|
|
||||||
func s:equivalence_test()
|
func s:equivalence_test()
|
||||||
let str = "A<><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD> B C D E<><45><EFBFBD><EFBFBD> F G H I<><49><EFBFBD><EFBFBD> J K L M N<> O<><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD> P Q R S T U<><55><EFBFBD><EFBFBD> V W X Y<> Z a<><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b c d e<><65><EFBFBD><EFBFBD> f g h i<><69><EFBFBD><EFBFBD> j k l m n<> o<><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD> p q r s t u<><75><EFBFBD><EFBFBD> v w x y<><79> z"
|
let str = "A<><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD> B C D E<><45><EFBFBD><EFBFBD> F G H I<><49><EFBFBD><EFBFBD> J K L M N<> O<><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD> P Q R S T U<><55><EFBFBD><EFBFBD> V W X Y<> Z a<><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b c d e<><65><EFBFBD><EFBFBD> f g h i<><69><EFBFBD><EFBFBD> j k l m n<> o<><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD> p q r s t u<><75><EFBFBD><EFBFBD> v w x y<><79> z"
|
||||||
let groups = split(str)
|
let groups = split(str)
|
||||||
@@ -132,9 +134,9 @@ func Test_range_with_newline()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_pattern_compile_speed()
|
func Test_pattern_compile_speed()
|
||||||
if !exists('+spellcapcheck') || !has('reltime')
|
CheckOption spellcapcheck
|
||||||
return
|
CheckFunction reltimefloat
|
||||||
endif
|
|
||||||
let start = reltime()
|
let start = reltime()
|
||||||
" this used to be very slow, not it should be about a second
|
" this used to be very slow, not it should be about a second
|
||||||
set spc=\\v(((((Nxxxxxxx&&xxxx){179})+)+)+){179}
|
set spc=\\v(((((Nxxxxxxx&&xxxx){179})+)+)+){179}
|
||||||
|
@@ -34,7 +34,7 @@ func Test_rubyfile()
|
|||||||
call delete(tempfile)
|
call delete(tempfile)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_cursor()
|
func Test_ruby_set_cursor()
|
||||||
" Check that setting the cursor position works.
|
" Check that setting the cursor position works.
|
||||||
new
|
new
|
||||||
call setline(1, ['first line', 'second line'])
|
call setline(1, ['first line', 'second line'])
|
||||||
@@ -54,7 +54,7 @@ func Test_set_cursor()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test buffer.count and buffer.length (number of lines in buffer)
|
" Test buffer.count and buffer.length (number of lines in buffer)
|
||||||
func Test_buffer_count()
|
func Test_ruby_buffer_count()
|
||||||
new
|
new
|
||||||
call setline(1, ['one', 'two', 'three'])
|
call setline(1, ['one', 'two', 'three'])
|
||||||
call assert_equal(3, rubyeval('$curbuf.count'))
|
call assert_equal(3, rubyeval('$curbuf.count'))
|
||||||
@@ -63,7 +63,7 @@ func Test_buffer_count()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test buffer.name (buffer name)
|
" Test buffer.name (buffer name)
|
||||||
func Test_buffer_name()
|
func Test_ruby_buffer_name()
|
||||||
new Xfoo
|
new Xfoo
|
||||||
call assert_equal(expand('%:p'), rubyeval('$curbuf.name'))
|
call assert_equal(expand('%:p'), rubyeval('$curbuf.name'))
|
||||||
bwipe
|
bwipe
|
||||||
@@ -71,7 +71,7 @@ func Test_buffer_name()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test buffer.number (number of the buffer).
|
" Test buffer.number (number of the buffer).
|
||||||
func Test_buffer_number()
|
func Test_ruby_buffer_number()
|
||||||
new
|
new
|
||||||
call assert_equal(bufnr('%'), rubyeval('$curbuf.number'))
|
call assert_equal(bufnr('%'), rubyeval('$curbuf.number'))
|
||||||
new
|
new
|
||||||
@@ -81,7 +81,7 @@ func Test_buffer_number()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test buffer.delete({n}) (delete line {n})
|
" Test buffer.delete({n}) (delete line {n})
|
||||||
func Test_buffer_delete()
|
func Test_ruby_buffer_delete()
|
||||||
new
|
new
|
||||||
call setline(1, ['one', 'two', 'three'])
|
call setline(1, ['one', 'two', 'three'])
|
||||||
ruby $curbuf.delete(2)
|
ruby $curbuf.delete(2)
|
||||||
@@ -94,7 +94,7 @@ func Test_buffer_delete()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test buffer.append({str}, str) (append line {str} after line {n})
|
" Test buffer.append({str}, str) (append line {str} after line {n})
|
||||||
func Test_buffer_append()
|
func Test_ruby_buffer_append()
|
||||||
new
|
new
|
||||||
ruby $curbuf.append(0, 'one')
|
ruby $curbuf.append(0, 'one')
|
||||||
ruby $curbuf.append(1, 'three')
|
ruby $curbuf.append(1, 'three')
|
||||||
@@ -112,7 +112,7 @@ func Test_buffer_append()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test buffer.line (get or set the current line)
|
" Test buffer.line (get or set the current line)
|
||||||
func Test_buffer_line()
|
func Test_ruby_buffer_line()
|
||||||
new
|
new
|
||||||
call setline(1, ['one', 'two', 'three'])
|
call setline(1, ['one', 'two', 'three'])
|
||||||
2
|
2
|
||||||
@@ -125,7 +125,7 @@ func Test_buffer_line()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test buffer.line_number (get current line number)
|
" Test buffer.line_number (get current line number)
|
||||||
func Test_buffer_line_number()
|
func Test_ruby_buffer_line_number()
|
||||||
new
|
new
|
||||||
call setline(1, ['one', 'two', 'three'])
|
call setline(1, ['one', 'two', 'three'])
|
||||||
2
|
2
|
||||||
@@ -134,7 +134,7 @@ func Test_buffer_line_number()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_buffer_get()
|
func Test_ruby_buffer_get()
|
||||||
new
|
new
|
||||||
call setline(1, ['one', 'two'])
|
call setline(1, ['one', 'two'])
|
||||||
call assert_equal('one', rubyeval('$curbuf[1]'))
|
call assert_equal('one', rubyeval('$curbuf[1]'))
|
||||||
@@ -148,7 +148,7 @@ func Test_buffer_get()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_buffer_set()
|
func Test_ruby_buffer_set()
|
||||||
new
|
new
|
||||||
call setline(1, ['one', 'two'])
|
call setline(1, ['one', 'two'])
|
||||||
ruby $curbuf[2] = 'TWO'
|
ruby $curbuf[2] = 'TWO'
|
||||||
@@ -162,7 +162,7 @@ func Test_buffer_set()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test window.width (get or set window height).
|
" Test window.width (get or set window height).
|
||||||
func Test_window_height()
|
func Test_ruby_window_height()
|
||||||
new
|
new
|
||||||
|
|
||||||
" Test setting window height
|
" Test setting window height
|
||||||
@@ -176,7 +176,7 @@ func Test_window_height()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test window.width (get or set window width).
|
" Test window.width (get or set window width).
|
||||||
func Test_window_width()
|
func Test_ruby_window_width()
|
||||||
vnew
|
vnew
|
||||||
|
|
||||||
" Test setting window width
|
" Test setting window width
|
||||||
@@ -190,7 +190,7 @@ func Test_window_width()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test window.buffer (get buffer object of a window object).
|
" Test window.buffer (get buffer object of a window object).
|
||||||
func Test_window_buffer()
|
func Test_ruby_window_buffer()
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
new Xfoo2
|
new Xfoo2
|
||||||
ruby $b2 = $curwin.buffer
|
ruby $b2 = $curwin.buffer
|
||||||
@@ -209,14 +209,14 @@ func Test_window_buffer()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test Vim::Window.current (get current window object)
|
" Test Vim::Window.current (get current window object)
|
||||||
func Test_Vim_window_current()
|
func Test_ruby_Vim_window_current()
|
||||||
let cw = rubyeval('$curwin')
|
let cw = rubyeval('$curwin')
|
||||||
call assert_equal(cw, rubyeval('Vim::Window.current'))
|
call assert_equal(cw, rubyeval('Vim::Window.current'))
|
||||||
call assert_match('^#<Vim::Window:0x\x\+>$', cw)
|
call assert_match('^#<Vim::Window:0x\x\+>$', cw)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test Vim::Window.count (number of windows)
|
" Test Vim::Window.count (number of windows)
|
||||||
func Test_Vim_window_count()
|
func Test_ruby_Vim_window_count()
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
new Xfoo2
|
new Xfoo2
|
||||||
split
|
split
|
||||||
@@ -226,7 +226,7 @@ func Test_Vim_window_count()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test Vim::Window[n] (get window object of window n)
|
" Test Vim::Window[n] (get window object of window n)
|
||||||
func Test_Vim_window_get()
|
func Test_ruby_Vim_window_get()
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
new Xfoo2
|
new Xfoo2
|
||||||
call assert_match('Xfoo2$', rubyeval('Vim::Window[0].buffer.name'))
|
call assert_match('Xfoo2$', rubyeval('Vim::Window[0].buffer.name'))
|
||||||
@@ -238,14 +238,14 @@ func Test_Vim_window_get()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test Vim::Buffer.current (return the buffer object of current buffer)
|
" Test Vim::Buffer.current (return the buffer object of current buffer)
|
||||||
func Test_Vim_buffer_current()
|
func Test_ruby_Vim_buffer_current()
|
||||||
let cb = rubyeval('$curbuf')
|
let cb = rubyeval('$curbuf')
|
||||||
call assert_equal(cb, rubyeval('Vim::Buffer.current'))
|
call assert_equal(cb, rubyeval('Vim::Buffer.current'))
|
||||||
call assert_match('^#<Vim::Buffer:0x\x\+>$', cb)
|
call assert_match('^#<Vim::Buffer:0x\x\+>$', cb)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test Vim::Buffer:.count (return the number of buffers)
|
" Test Vim::Buffer:.count (return the number of buffers)
|
||||||
func Test_Vim_buffer_count()
|
func Test_ruby_Vim_buffer_count()
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
new Xfoo2
|
new Xfoo2
|
||||||
call assert_equal(3, rubyeval('Vim::Buffer.count'))
|
call assert_equal(3, rubyeval('Vim::Buffer.count'))
|
||||||
@@ -254,7 +254,7 @@ func Test_Vim_buffer_count()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test Vim::buffer[n] (return the buffer object of buffer number n)
|
" Test Vim::buffer[n] (return the buffer object of buffer number n)
|
||||||
func Test_Vim_buffer_get()
|
func Test_ruby_Vim_buffer_get()
|
||||||
new Xfoo1
|
new Xfoo1
|
||||||
new Xfoo2
|
new Xfoo2
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ endfunc
|
|||||||
|
|
||||||
" Test Vim::command({cmd}) (execute a Ex command))
|
" Test Vim::command({cmd}) (execute a Ex command))
|
||||||
" Test Vim::command({cmd})
|
" Test Vim::command({cmd})
|
||||||
func Test_Vim_command()
|
func Test_ruby_Vim_command()
|
||||||
new
|
new
|
||||||
call setline(1, ['one', 'two', 'three', 'four'])
|
call setline(1, ['one', 'two', 'three', 'four'])
|
||||||
ruby Vim::command('2,3d')
|
ruby Vim::command('2,3d')
|
||||||
@@ -278,7 +278,7 @@ func Test_Vim_command()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test Vim::set_option (set a vim option)
|
" Test Vim::set_option (set a vim option)
|
||||||
func Test_Vim_set_option()
|
func Test_ruby_Vim_set_option()
|
||||||
call assert_equal(0, &number)
|
call assert_equal(0, &number)
|
||||||
ruby Vim::set_option('number')
|
ruby Vim::set_option('number')
|
||||||
call assert_equal(1, &number)
|
call assert_equal(1, &number)
|
||||||
@@ -286,14 +286,16 @@ func Test_Vim_set_option()
|
|||||||
call assert_equal(0, &number)
|
call assert_equal(0, &number)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_Vim_evaluate()
|
func Test_ruby_Vim_evaluate()
|
||||||
call assert_equal(123, rubyeval('Vim::evaluate("123")'))
|
call assert_equal(123, rubyeval('Vim::evaluate("123")'))
|
||||||
" Vim::evaluate("123").class gives Integer or Fixnum depending
|
" Vim::evaluate("123").class gives Integer or Fixnum depending
|
||||||
" on versions of Ruby.
|
" on versions of Ruby.
|
||||||
call assert_match('^Integer\|Fixnum$', rubyeval('Vim::evaluate("123").class'))
|
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(1.23, rubyeval('Vim::evaluate("1.23")'))
|
||||||
call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class'))
|
call assert_equal('Float', rubyeval('Vim::evaluate("1.23").class'))
|
||||||
|
endif
|
||||||
|
|
||||||
call assert_equal('foo', rubyeval('Vim::evaluate("\"foo\"")'))
|
call assert_equal('foo', rubyeval('Vim::evaluate("\"foo\"")'))
|
||||||
call assert_equal('String', rubyeval('Vim::evaluate("\"foo\"").class'))
|
call assert_equal('String', rubyeval('Vim::evaluate("\"foo\"").class'))
|
||||||
@@ -319,14 +321,14 @@ func Test_Vim_evaluate()
|
|||||||
call assert_equal('FalseClass',rubyeval('Vim::evaluate("v:false").class'))
|
call assert_equal('FalseClass',rubyeval('Vim::evaluate("v:false").class'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_Vim_blob()
|
func Test_ruby_Vim_blob()
|
||||||
call assert_equal('0z', rubyeval('Vim::blob("")'))
|
call assert_equal('0z', rubyeval('Vim::blob("")'))
|
||||||
call assert_equal('0z31326162', rubyeval('Vim::blob("12ab")'))
|
call assert_equal('0z31326162', rubyeval('Vim::blob("12ab")'))
|
||||||
call assert_equal('0z00010203', rubyeval('Vim::blob("\x00\x01\x02\x03")'))
|
call assert_equal('0z00010203', rubyeval('Vim::blob("\x00\x01\x02\x03")'))
|
||||||
call assert_equal('0z8081FEFF', rubyeval('Vim::blob("\x80\x81\xfe\xff")'))
|
call assert_equal('0z8081FEFF', rubyeval('Vim::blob("\x80\x81\xfe\xff")'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_Vim_evaluate_list()
|
func Test_ruby_Vim_evaluate_list()
|
||||||
call setline(line('$'), ['2 line 2'])
|
call setline(line('$'), ['2 line 2'])
|
||||||
ruby Vim.command("normal /^2\n")
|
ruby Vim.command("normal /^2\n")
|
||||||
let l = ["abc", "def"]
|
let l = ["abc", "def"]
|
||||||
@@ -340,7 +342,7 @@ EOF
|
|||||||
call assert_equal('abc/def', getline('$'))
|
call assert_equal('abc/def', getline('$'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_Vim_evaluate_dict()
|
func Test_ruby_Vim_evaluate_dict()
|
||||||
let d = {'a': 'foo', 'b': 123}
|
let d = {'a': 'foo', 'b': 123}
|
||||||
redir => l:out
|
redir => l:out
|
||||||
ruby d = Vim.evaluate("d"); print d
|
ruby d = Vim.evaluate("d"); print d
|
||||||
@@ -349,13 +351,13 @@ func Test_Vim_evaluate_dict()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test Vim::message({msg}) (display message {msg})
|
" Test Vim::message({msg}) (display message {msg})
|
||||||
func Test_Vim_message()
|
func Test_ruby_Vim_message()
|
||||||
ruby Vim::message('A message')
|
ruby Vim::message('A message')
|
||||||
let messages = split(execute('message'), "\n")
|
let messages = split(execute('message'), "\n")
|
||||||
call assert_equal('A message', messages[-1])
|
call assert_equal('A message', messages[-1])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_print()
|
func Test_ruby_print()
|
||||||
func RubyPrint(expr)
|
func RubyPrint(expr)
|
||||||
return trim(execute('ruby print ' . a:expr))
|
return trim(execute('ruby print ' . a:expr))
|
||||||
endfunc
|
endfunc
|
||||||
@@ -374,7 +376,7 @@ func Test_print()
|
|||||||
delfunc RubyPrint
|
delfunc RubyPrint
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_p()
|
func Test_ruby_p()
|
||||||
ruby p 'Just a test'
|
ruby p 'Just a test'
|
||||||
let messages = split(execute('message'), "\n")
|
let messages = split(execute('message'), "\n")
|
||||||
call assert_equal('"Just a test"', messages[-1])
|
call assert_equal('"Just a test"', messages[-1])
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
" Tests for the "sort()" function and for the ":sort" command.
|
" Tests for the "sort()" function and for the ":sort" command.
|
||||||
|
|
||||||
|
source check.vim
|
||||||
|
|
||||||
func Compare1(a, b) abort
|
func Compare1(a, b) abort
|
||||||
call sort(range(3), 'Compare2')
|
call sort(range(3), 'Compare2')
|
||||||
return a:a - a:b
|
return a:a - a:b
|
||||||
@@ -28,6 +30,7 @@ func Test_sort_numbers()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_sort_float()
|
func Test_sort_float()
|
||||||
|
CheckFeature float
|
||||||
call assert_equal([0.28, 3, 13.5], sort([13.5, 0.28, 3], 'f'))
|
call assert_equal([0.28, 3, 13.5], sort([13.5, 0.28, 3], 'f'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -37,6 +40,8 @@ func Test_sort_nested()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_sort_default()
|
func Test_sort_default()
|
||||||
|
CheckFeature float
|
||||||
|
|
||||||
" docs say omitted, empty or zero argument sorts on string representation.
|
" 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"]))
|
||||||
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"], ''))
|
||||||
@@ -1145,30 +1150,6 @@ func Test_sort_cmd()
|
|||||||
\ ]
|
\ ]
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ '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'
|
|
||||||
\ ]
|
|
||||||
\ },
|
|
||||||
\ {
|
|
||||||
\ 'name' : 'alphabetical, sorted input',
|
\ 'name' : 'alphabetical, sorted input',
|
||||||
\ 'cmd' : 'sort',
|
\ 'cmd' : 'sort',
|
||||||
\ 'input' : [
|
\ 'input' : [
|
||||||
@@ -1223,6 +1204,35 @@ func Test_sort_cmd()
|
|||||||
\ },
|
\ },
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
|
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
|
for t in tests
|
||||||
enew!
|
enew!
|
||||||
call append(0, t.input)
|
call append(0, t.input)
|
||||||
|
@@ -290,6 +290,7 @@ func Test_timer_getchar_zero()
|
|||||||
if has('win32') && !has('gui_running')
|
if has('win32') && !has('gui_running')
|
||||||
throw 'Skipped: cannot get low-level input'
|
throw 'Skipped: cannot get low-level input'
|
||||||
endif
|
endif
|
||||||
|
CheckFunction reltimefloat
|
||||||
|
|
||||||
" Measure the elapsed time to avoid a hang when it fails.
|
" Measure the elapsed time to avoid a hang when it fails.
|
||||||
let start = reltime()
|
let start = reltime()
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
" Test behavior of boolean-like values.
|
" Test behavior of boolean-like values.
|
||||||
|
|
||||||
|
source check.vim
|
||||||
|
|
||||||
" Test what is explained at ":help TRUE" and ":help FALSE".
|
" Test what is explained at ":help TRUE" and ":help FALSE".
|
||||||
func Test_if()
|
func Test_if()
|
||||||
if v:false
|
if v:false
|
||||||
@@ -41,7 +43,9 @@ func Test_if()
|
|||||||
call assert_fails('if [1]', 'E745')
|
call assert_fails('if [1]', 'E745')
|
||||||
call assert_fails('if {1: 1}', 'E728')
|
call assert_fails('if {1: 1}', 'E728')
|
||||||
call assert_fails('if function("string")', 'E703')
|
call assert_fails('if function("string")', 'E703')
|
||||||
|
if has('float')
|
||||||
call assert_fails('if 1.3")', 'E805')
|
call assert_fails('if 1.3")', 'E805')
|
||||||
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function Try_arg_true_false(expr, false_val, true_val)
|
function Try_arg_true_false(expr, false_val, true_val)
|
||||||
@@ -113,6 +117,7 @@ func Test_true_false_arg()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function Try_arg_non_zero(expr, false_val, true_val)
|
function Try_arg_non_zero(expr, false_val, true_val)
|
||||||
|
CheckFeature float
|
||||||
for v in ['v:false', '0', '[1]', '{2:3}', '3.4']
|
for v in ['v:false', '0', '[1]', '{2:3}', '3.4']
|
||||||
let r = eval(substitute(a:expr, '%v%', v, ''))
|
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)
|
call assert_equal(a:false_val, r, 'result for ' . v . ' is not ' . a:false_val . ' but ' . r)
|
||||||
|
@@ -121,9 +121,11 @@ func MakeBadFunc()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_default_arg()
|
func Test_default_arg()
|
||||||
|
if has('float')
|
||||||
call assert_equal(1.0, Log(10))
|
call assert_equal(1.0, Log(10))
|
||||||
call assert_equal(log(10), Log(10, exp(1)))
|
call assert_equal(log(10), Log(10, exp(1)))
|
||||||
call assert_fails("call Log(1,2,3)", 'E118')
|
call assert_fails("call Log(1,2,3)", 'E118')
|
||||||
|
endif
|
||||||
|
|
||||||
let res = Args(1)
|
let res = Args(1)
|
||||||
call assert_equal(res.mandatory, 1)
|
call assert_equal(res.mandatory, 1)
|
||||||
|
@@ -19,7 +19,9 @@ endfunc
|
|||||||
def Test_expr1()
|
def Test_expr1()
|
||||||
assert_equal('one', true ? 'one' : 'two')
|
assert_equal('one', true ? 'one' : 'two')
|
||||||
assert_equal('one', 1 ? 'one' : 'two')
|
assert_equal('one', 1 ? 'one' : 'two')
|
||||||
|
if has('float')
|
||||||
assert_equal('one', 0.1 ? 'one' : 'two')
|
assert_equal('one', 0.1 ? 'one' : 'two')
|
||||||
|
endif
|
||||||
assert_equal('one', 'x' ? 'one' : 'two')
|
assert_equal('one', 'x' ? 'one' : 'two')
|
||||||
" assert_equal('one', 0z1234 ? 'one' : 'two')
|
" assert_equal('one', 0z1234 ? 'one' : 'two')
|
||||||
assert_equal('one', [0] ? 'one' : 'two')
|
assert_equal('one', [0] ? 'one' : 'two')
|
||||||
|
@@ -1142,7 +1142,9 @@ func Test_type()
|
|||||||
call assert_equal(2, type(function("tr", [8])))
|
call assert_equal(2, type(function("tr", [8])))
|
||||||
call assert_equal(3, type([]))
|
call assert_equal(3, type([]))
|
||||||
call assert_equal(4, type({}))
|
call assert_equal(4, type({}))
|
||||||
|
if has('float')
|
||||||
call assert_equal(5, type(0.0))
|
call assert_equal(5, type(0.0))
|
||||||
|
endif
|
||||||
call assert_equal(6, type(v:false))
|
call assert_equal(6, type(v:false))
|
||||||
call assert_equal(6, type(v:true))
|
call assert_equal(6, type(v:true))
|
||||||
call assert_equal(7, type(v:none))
|
call assert_equal(7, type(v:none))
|
||||||
@@ -1155,7 +1157,9 @@ func Test_type()
|
|||||||
call assert_equal(v:t_func, type(function("tr", [8])))
|
call assert_equal(v:t_func, type(function("tr", [8])))
|
||||||
call assert_equal(v:t_list, type([]))
|
call assert_equal(v:t_list, type([]))
|
||||||
call assert_equal(v:t_dict, type({}))
|
call assert_equal(v:t_dict, type({}))
|
||||||
|
if has('float')
|
||||||
call assert_equal(v:t_float, type(0.0))
|
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:false))
|
||||||
call assert_equal(v:t_bool, type(v:true))
|
call assert_equal(v:t_bool, type(v:true))
|
||||||
call assert_equal(v:t_none, type(v:none))
|
call assert_equal(v:t_none, type(v:none))
|
||||||
@@ -1425,8 +1429,10 @@ func Test_num64()
|
|||||||
call assert_equal(-9223372036854775807, -1 / 0)
|
call assert_equal(-9223372036854775807, -1 / 0)
|
||||||
call assert_equal(-9223372036854775807 - 1, 0 / 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))
|
||||||
call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150))
|
call assert_equal(-0x7FFFffffFFFFffff, float2nr(-1.0e150))
|
||||||
|
endif
|
||||||
|
|
||||||
let rng = range(0xFFFFffff, 0x100000001)
|
let rng = range(0xFFFFffff, 0x100000001)
|
||||||
call assert_equal([0xFFFFffff, 0x100000000, 0x100000001], rng)
|
call assert_equal([0xFFFFffff, 0x100000000, 0x100000001], rng)
|
||||||
@@ -1526,10 +1532,12 @@ func Test_bitwise_functions()
|
|||||||
call assert_equal(16, and(127, 16))
|
call assert_equal(16, and(127, 16))
|
||||||
eval 127->and(16)->assert_equal(16)
|
eval 127->and(16)->assert_equal(16)
|
||||||
call assert_equal(0, and(127, 128))
|
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)", 'E745:')
|
||||||
call assert_fails("call and({}, 1)", 'E728:')
|
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:')
|
call assert_fails("call and(1, 1.0)", 'E805:')
|
||||||
|
endif
|
||||||
call assert_fails("call and(1, [])", 'E745:')
|
call assert_fails("call and(1, [])", 'E745:')
|
||||||
call assert_fails("call and(1, {})", 'E728:')
|
call assert_fails("call and(1, {})", 'E728:')
|
||||||
" or
|
" or
|
||||||
@@ -1537,10 +1545,12 @@ func Test_bitwise_functions()
|
|||||||
call assert_equal(15, or(8, 7))
|
call assert_equal(15, or(8, 7))
|
||||||
eval 8->or(7)->assert_equal(15)
|
eval 8->or(7)->assert_equal(15)
|
||||||
call assert_equal(123, or(0, 123))
|
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)", 'E745:')
|
||||||
call assert_fails("call or({}, 1)", 'E728:')
|
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:')
|
call assert_fails("call or(1, 1.0)", 'E805:')
|
||||||
|
endif
|
||||||
call assert_fails("call or(1, [])", 'E745:')
|
call assert_fails("call or(1, [])", 'E745:')
|
||||||
call assert_fails("call or(1, {})", 'E728:')
|
call assert_fails("call or(1, {})", 'E728:')
|
||||||
" xor
|
" xor
|
||||||
@@ -1548,10 +1558,12 @@ func Test_bitwise_functions()
|
|||||||
call assert_equal(111, xor(127, 16))
|
call assert_equal(111, xor(127, 16))
|
||||||
eval 127->xor(16)->assert_equal(111)
|
eval 127->xor(16)->assert_equal(111)
|
||||||
call assert_equal(255, xor(127, 128))
|
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.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)", 'E745:')
|
||||||
call assert_fails("call xor({}, 1)", 'E728:')
|
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, [])", 'E745:')
|
||||||
call assert_fails("call xor(1, {})", 'E728:')
|
call assert_fails("call xor(1, {})", 'E728:')
|
||||||
" invert
|
" invert
|
||||||
@@ -1559,7 +1571,9 @@ func Test_bitwise_functions()
|
|||||||
eval 127->invert()->and(65535)->assert_equal(65408)
|
eval 127->invert()->and(65535)->assert_equal(65408)
|
||||||
call assert_equal(65519, and(invert(16), 65535))
|
call assert_equal(65519, and(invert(16), 65535))
|
||||||
call assert_equal(65407, and(invert(128), 65535))
|
call assert_equal(65407, and(invert(128), 65535))
|
||||||
|
if has('float')
|
||||||
call assert_fails("call invert(1.0)", 'E805:')
|
call assert_fails("call invert(1.0)", 'E805:')
|
||||||
|
endif
|
||||||
call assert_fails("call invert([])", 'E745:')
|
call assert_fails("call invert([])", 'E745:')
|
||||||
call assert_fails("call invert({})", 'E728:')
|
call assert_fails("call invert({})", 'E728:')
|
||||||
endfunc
|
endfunc
|
||||||
@@ -1718,11 +1732,11 @@ func Test_compound_assignment_operators()
|
|||||||
call assert_equal('string', x)
|
call assert_equal('string', x)
|
||||||
let x += 1
|
let x += 1
|
||||||
call assert_equal(1, x)
|
call assert_equal(1, x)
|
||||||
let x -= 1.5
|
|
||||||
call assert_equal(-0.5, x)
|
|
||||||
|
|
||||||
if has('float')
|
if has('float')
|
||||||
" Test for float
|
" Test for float
|
||||||
|
let x -= 1.5
|
||||||
|
call assert_equal(-0.5, x)
|
||||||
let x = 0.5
|
let x = 0.5
|
||||||
let x += 4.5
|
let x += 4.5
|
||||||
call assert_equal(5.0, x)
|
call assert_equal(5.0, x)
|
||||||
|
@@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
183,
|
||||||
/**/
|
/**/
|
||||||
182,
|
182,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user