summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-18 23:01:56 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-18 23:01:56 +0200
commit073e4b92e613d22ce7b16e0fbf5c0e40cb5f9b2c (patch)
tree627a153c9bb3076e512a6b0209227b66d5255ce5 /src/testdir
parent0a52df50a0e8fce6f5e0eb5f5373dcd0fa24d83a (diff)
patch 8.1.1888: more functions can be used as methodsv8.1.1888
Problem: More functions can be used as methods. Solution: Make various functions usable as a method.
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_arglist.vim4
-rw-r--r--src/testdir/test_balloon_gui.vim2
-rw-r--r--src/testdir/test_functions.vim6
-rw-r--r--src/testdir/test_hide.vim2
-rw-r--r--src/testdir/test_popup.vim20
-rw-r--r--src/testdir/test_vimscript.vim4
6 files changed, 21 insertions, 17 deletions
diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim
index fc086fa434..a382a1a549 100644
--- a/src/testdir/test_arglist.vim
+++ b/src/testdir/test_arglist.vim
@@ -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('$'))
call delete('Xargadd')
diff --git a/src/testdir/test_balloon_gui.vim b/src/testdir/test_balloon_gui.vim
index 5b486c0b73..70a88f36f1 100644
--- a/src/testdir/test_balloon_gui.vim
+++ b/src/testdir/test_balloon_gui.vim
@@ -12,7 +12,7 @@ func Test_balloon_show_gui()
call balloon_show('')
let msg = 'that that'
- call balloon_show(msg)
+ eval msg->balloon_show()
call assert_equal(msg, balloon_gettext())
sleep 10m
call balloon_show('')
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 474e6384e8..5249d4e946 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1537,12 +1537,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(''))
diff --git a/src/testdir/test_hide.vim b/src/testdir/test_hide.vim
index 128b8ff945..41b1a4ad7c 100644
--- a/src/testdir/test_hide.vim
+++ b/src/testdir/test_hide.vim
@@ -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
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index d9f561bc7f..6c86d6936a 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -758,9 +758,8 @@ func Test_popup_and_previewwindow_dump()
endfunc
func Test_balloon_split()
- if !exists('*balloon_split')
- return
- endif
+ CheckFunction balloon_split
+
call assert_equal([
\ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"',
\ ], balloon_split(
@@ -771,13 +770,14 @@ func Test_balloon_split()
\ ], balloon_split(
\ 'one two three four one two three four one two three four'))
- call assert_equal([
- \ 'struct = {',
- \ ' one = 1,',
- \ ' two = 2,',
- \ ' three = 3}',
- \ ], balloon_split(
- \ 'struct = {one = 1, two = 2, three = 3}'))
+ eval 'struct = {one = 1, two = 2, three = 3}'
+ \ ->balloon_split()
+ \ ->assert_equal([
+ \ 'struct = {',
+ \ ' one = 1,',
+ \ ' two = 2,',
+ \ ' three = 3}',
+ \ ])
call assert_equal([
\ 'struct = {',
diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim
index 69a2ebafda..dc4df4448f 100644
--- a/src/testdir/test_vimscript.vim
+++ b/src/testdir/test_vimscript.vim
@@ -1330,6 +1330,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:')
@@ -1340,6 +1341,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:')
@@ -1350,6 +1352,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:')
@@ -1359,6 +1362,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:')