summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-04 22:29:14 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-04 22:29:14 +0200
commita0d1fef4ebb693696464c5e22e33269f724b8e0e (patch)
tree4c29126b625309533e0b6f0423ce4b66bae392b8 /src/testdir
parenta5a7882ea4a21944924b778208e1d54734891033 (diff)
downloadvim-git-a0d1fef4ebb693696464c5e22e33269f724b8e0e.tar.gz
patch 8.1.1987: more functions can be used as methodsv8.1.1987
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_clientserver.vim12
-rw-r--r--src/testdir/test_eval_stuff.vim2
-rw-r--r--src/testdir/test_functions.vim6
-rw-r--r--src/testdir/test_reltime.vim6
-rw-r--r--src/testdir/test_rename.vim2
5 files changed, 14 insertions, 14 deletions
diff --git a/src/testdir/test_clientserver.vim b/src/testdir/test_clientserver.vim
index 385ff9129..2e4a66ef8 100644
--- a/src/testdir/test_clientserver.vim
+++ b/src/testdir/test_clientserver.vim
@@ -34,7 +34,7 @@ func Test_client_server()
" When using valgrind it takes much longer.
call WaitForAssert({-> assert_match(name, serverlist())})
- call remote_foreground(name)
+ eval name->remote_foreground()
call remote_send(name, ":let testvar = 'yes'\<CR>")
call WaitFor('remote_expr("' . name . '", "exists(\"testvar\") ? testvar : \"\"", "", 1) == "yes"')
@@ -53,7 +53,7 @@ func Test_client_server()
endif
" Wait for the server to be up and answering requests.
sleep 100m
- call WaitForAssert({-> assert_true(remote_expr(name, "v:version", "", 1) != "")})
+ call WaitForAssert({-> assert_true(name->remote_expr("v:version", "", 1) != "")})
call remote_send(name, ":let testvar = 'maybe'\<CR>")
call WaitForAssert({-> assert_equal('maybe', remote_expr(name, "testvar", "", 2))})
@@ -63,7 +63,7 @@ func Test_client_server()
" Expression evaluated locally.
if v:servername == ''
- call remote_startserver('MYSELF')
+ eval 'MYSELF'->remote_startserver()
" May get MYSELF1 when running the test again.
call assert_match('MYSELF', v:servername)
endif
@@ -71,11 +71,11 @@ func Test_client_server()
call assert_equal('myself', remote_expr(v:servername, 'testvar'))
call remote_send(name, ":call server2client(expand('<client>'), 'got it')\<CR>", 'g:myserverid')
- call assert_equal('got it', remote_read(g:myserverid, 2))
+ call assert_equal('got it', g:myserverid->remote_read(2))
call remote_send(name, ":call server2client(expand('<client>'), 'another')\<CR>", 'g:myserverid')
let peek_result = 'nothing'
- let r = remote_peek(g:myserverid, 'peek_result')
+ let r = g:myserverid->remote_peek('peek_result')
" unpredictable whether the result is already available.
if r > 0
call assert_equal('another', peek_result)
@@ -89,7 +89,7 @@ func Test_client_server()
call assert_equal('another', g:peek_result)
call assert_equal('another', remote_read(g:myserverid, 2))
- call remote_send(name, ":qa!\<CR>")
+ eval name->remote_send(":qa!\<CR>")
try
call WaitForAssert({-> assert_equal("dead", job_status(job))})
finally
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index 82f9cac24..b518f5ae6 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -75,7 +75,7 @@ func Test_readfile_binary()
call setline(1, ['one', 'two', 'three'])
setlocal ff=dos
write XReadfile
- let lines = readfile('XReadfile')
+ let lines = 'XReadfile'->readfile()
call assert_equal(['one', 'two', 'three'], lines)
let lines = readfile('XReadfile', '', 2)
call assert_equal(['one', 'two'], lines)
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index fc22bcd32..dfd6a933b 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -253,7 +253,7 @@ func Test_resolve_unix()
call delete('Xlink')
silent !ln -s -f Xlink2/ Xlink1
- call assert_equal('Xlink2', resolve('Xlink1'))
+ call assert_equal('Xlink2', 'Xlink1'->resolve())
call assert_equal('Xlink2/', resolve('Xlink1/'))
call delete('Xlink1')
@@ -1413,7 +1413,7 @@ func Test_func_range_with_edit()
" is invalid in that buffer.
call writefile(['just one line'], 'Xfuncrange2')
new
- call setline(1, range(10))
+ call setline(1, 10->range())
write Xfuncrange1
call assert_fails('5,8call EditAnotherFile()', 'E16:')
@@ -1544,7 +1544,7 @@ func Test_readdir()
call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files))
" Only results containing "f"
- let files = readdir('Xdir', { x -> stridx(x, 'f') !=- 1 })
+ let files = 'Xdir'->readdir({ x -> stridx(x, 'f') !=- 1 })
call assert_equal(['foo.txt'], sort(files))
" Only .txt files
diff --git a/src/testdir/test_reltime.vim b/src/testdir/test_reltime.vim
index 404ea3f7a..e25c3cede 100644
--- a/src/testdir/test_reltime.vim
+++ b/src/testdir/test_reltime.vim
@@ -8,11 +8,11 @@ func Test_reltime()
let now = reltime()
sleep 10m
let later = reltime()
- let elapsed = reltime(now)
+ let elapsed = now->reltime()
call assert_true(reltimestr(elapsed) =~ '0\.0')
- call assert_true(reltimestr(elapsed) != '0.0')
+ call assert_true(elapsed->reltimestr() != '0.0')
call assert_true(reltimefloat(elapsed) < 0.1)
- call assert_true(reltimefloat(elapsed) > 0.0)
+ call assert_true(elapsed->reltimefloat() > 0.0)
let same = reltime(now, now)
call assert_equal('0.000', split(reltimestr(same))[0][:4])
diff --git a/src/testdir/test_rename.vim b/src/testdir/test_rename.vim
index 2311caf79..3887fcfab 100644
--- a/src/testdir/test_rename.vim
+++ b/src/testdir/test_rename.vim
@@ -25,7 +25,7 @@ func Test_rename_file_ignore_case()
set fileignorecase
call writefile(['foo'], 'Xrename')
- call assert_equal(0, rename('Xrename', 'XRENAME'))
+ call assert_equal(0, 'Xrename'->rename('XRENAME'))
call assert_equal(['foo'], readfile('XRENAME'))