vim-patch:8.1.1888: more functions can be used as methods

Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
073e4b92e6

test_popup.vim already has the changes from this patch (they're N/A
anyway).
This commit is contained in:
Sean Dewar
2021-08-07 17:06:08 +01:00
parent 41dbd3a2e0
commit 5fbc1a49c7
6 changed files with 53 additions and 22 deletions

View File

@@ -24,7 +24,7 @@ return {
abs={args=1, base=1},
acos={args=1, base=1, func="float_op_wrapper", data="&acos"}, -- WJMc
add={args=2, base=1},
['and']={args=2},
['and']={args=2, base=1},
api_info={},
append={args=2, base=LAST},
appendbufline={args=3, base=LAST},
@@ -50,16 +50,16 @@ return {
atan2={args=2, base=1},
browse={args=4},
browsedir={args=2},
bufadd={args=1},
bufexists={args=1},
buffer_exists={args=1, func='f_bufexists'}, -- obsolete
bufadd={args=1, base=1},
bufexists={args=1, base=1},
buffer_exists={args=1, base=1, func='f_bufexists'}, -- obsolete
buffer_name={args={0, 1}, func='f_bufname'}, -- obsolete
buffer_number={args={0, 1}, func='f_bufnr'}, -- obsolete
buflisted={args=1},
bufload={args=1},
bufloaded={args=1},
bufname={args={0, 1}},
bufnr={args={0, 2}},
buflisted={args=1, base=1},
bufload={args=1, base=1},
bufloaded={args=1, base=1},
bufname={args={0, 1}, base=1},
bufnr={args={0, 2}, base=1},
bufwinid={args=1},
bufwinnr={args=1},
byte2line={args=1},
@@ -203,7 +203,7 @@ return {
inputsecret={args={1, 2}},
insert={args={2, 3}, base=1},
interrupt={args=0},
invert={args=1},
invert={args=1, base=1},
isdirectory={args=1},
isinf={args=1, base=1},
islocked={args=1},
@@ -254,7 +254,7 @@ return {
msgpackparse={args=1},
nextnonblank={args=1},
nr2char={args={1, 2}},
['or']={args=2},
['or']={args=2, base=1},
pathshorten={args=1},
pow={args=2, base=1},
prevnonblank={args=1},
@@ -421,6 +421,6 @@ return {
winwidth={args=1},
wordcount={},
writefile={args={2, 3}},
xor={args=2},
xor={args=2, base=1},
},
}

View File

@@ -90,8 +90,8 @@ func Test_argadd_empty_curbuf()
call assert_equal('', bufname('%'))
call assert_equal(1, line('$'))
rew
call assert_notequal(curbuf, bufnr('%'))
call assert_equal('Xargadd', bufname('%'))
call assert_notequal(curbuf, '%'->bufnr())
call assert_equal('Xargadd', '%'->bufname())
call assert_equal(2, line('$'))
%argd

View File

@@ -1414,12 +1414,12 @@ func Test_bufadd_bufload()
let curbuf = bufnr('')
call writefile(['some', 'text'], 'XotherName')
let buf = bufadd('XotherName')
let buf = 'XotherName'->bufadd()
call assert_notequal(0, buf)
call assert_equal(1, bufexists('XotherName'))
eval 'XotherName'->bufexists()->assert_equal(1)
call assert_equal(0, getbufvar(buf, '&buflisted'))
call assert_equal(0, bufloaded(buf))
call bufload(buf)
eval buf->bufload()
call assert_equal(1, bufloaded(buf))
call assert_equal(['some', 'text'], getbufline(buf, 1, '$'))
call assert_equal(curbuf, bufnr(''))

View File

@@ -37,7 +37,7 @@ function Test_hide()
" :hide as a command
hide
call assert_equal([orig_bname, orig_winnr], [bufname(''), winnr('$')])
call assert_equal([1, 1], [buflisted('Xf1'), bufloaded('Xf1')])
call assert_equal([1, 1], ['Xf1'->buflisted(), 'Xf1'->bufloaded()])
bwipeout! Xf1
new Xf1

View File

@@ -1372,6 +1372,7 @@ func Test_bitwise_functions()
" and
call assert_equal(127, and(127, 127))
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:')
@@ -1382,6 +1383,7 @@ func Test_bitwise_functions()
" or
call assert_equal(23, or(16, 7))
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:')
@@ -1392,6 +1394,7 @@ func Test_bitwise_functions()
" xor
call assert_equal(0, xor(127, 127))
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:')
call assert_fails("call xor([], 1)", 'E745:')
@@ -1401,6 +1404,7 @@ func Test_bitwise_functions()
call assert_fails("call xor(1, {})", 'E728:')
" invert
call assert_equal(65408, and(invert(127), 65535))
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:')