comparison src/testdir/test_functions.vim @ 17982:2029737e6a22 v8.1.1987

patch 8.1.1987: more functions can be used as methods Commit: https://github.com/vim/vim/commit/a0d1fef4ebb693696464c5e22e33269f724b8e0e Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 4 22:29:14 2019 +0200 patch 8.1.1987: more functions can be used as methods Problem: More functions can be used as methods. Solution: Make various functions usable as a method.
author Bram Moolenaar <Bram@vim.org>
date Wed, 04 Sep 2019 22:30:03 +0200
parents 6d11a0d5751d
children 0dcc2ee838dd
comparison
equal deleted inserted replaced
17981:cf10d0482ad1 17982:2029737e6a22
251 silent !ln -s -f Xdir//Xfile Xlink 251 silent !ln -s -f Xdir//Xfile Xlink
252 call assert_equal('Xdir/Xfile', resolve('Xlink')) 252 call assert_equal('Xdir/Xfile', resolve('Xlink'))
253 call delete('Xlink') 253 call delete('Xlink')
254 254
255 silent !ln -s -f Xlink2/ Xlink1 255 silent !ln -s -f Xlink2/ Xlink1
256 call assert_equal('Xlink2', resolve('Xlink1')) 256 call assert_equal('Xlink2', 'Xlink1'->resolve())
257 call assert_equal('Xlink2/', resolve('Xlink1/')) 257 call assert_equal('Xlink2/', resolve('Xlink1/'))
258 call delete('Xlink1') 258 call delete('Xlink1')
259 259
260 silent !ln -s -f ./Xlink2 Xlink1 260 silent !ln -s -f ./Xlink2 Xlink1
261 call assert_equal('Xlink2', resolve('Xlink1')) 261 call assert_equal('Xlink2', resolve('Xlink1'))
1411 func Test_func_range_with_edit() 1411 func Test_func_range_with_edit()
1412 " Define a function that edits another buffer, then call it with a range that 1412 " Define a function that edits another buffer, then call it with a range that
1413 " is invalid in that buffer. 1413 " is invalid in that buffer.
1414 call writefile(['just one line'], 'Xfuncrange2') 1414 call writefile(['just one line'], 'Xfuncrange2')
1415 new 1415 new
1416 call setline(1, range(10)) 1416 call setline(1, 10->range())
1417 write Xfuncrange1 1417 write Xfuncrange1
1418 call assert_fails('5,8call EditAnotherFile()', 'E16:') 1418 call assert_fails('5,8call EditAnotherFile()', 'E16:')
1419 1419
1420 call delete('Xfuncrange1') 1420 call delete('Xfuncrange1')
1421 call delete('Xfuncrange2') 1421 call delete('Xfuncrange2')
1542 " All results 1542 " All results
1543 let files = readdir('Xdir') 1543 let files = readdir('Xdir')
1544 call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files)) 1544 call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files))
1545 1545
1546 " Only results containing "f" 1546 " Only results containing "f"
1547 let files = readdir('Xdir', { x -> stridx(x, 'f') !=- 1 }) 1547 let files = 'Xdir'->readdir({ x -> stridx(x, 'f') !=- 1 })
1548 call assert_equal(['foo.txt'], sort(files)) 1548 call assert_equal(['foo.txt'], sort(files))
1549 1549
1550 " Only .txt files 1550 " Only .txt files
1551 let files = readdir('Xdir', { x -> x =~ '.txt$' }) 1551 let files = readdir('Xdir', { x -> x =~ '.txt$' })
1552 call assert_equal(['bar.txt', 'foo.txt'], sort(files)) 1552 call assert_equal(['bar.txt', 'foo.txt'], sort(files))