comparison src/testdir/test_expr.vim @ 17849:73ddc462979d v8.1.1921

patch 8.1.1921: more functions can be used as methods Commit: https://github.com/vim/vim/commit/a4208966fb289a505ebdef62bbc37c214069bab4 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 24 20:50:19 2019 +0200 patch 8.1.1921: 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 Sat, 24 Aug 2019 21:00:05 +0200
parents 77bcb5055fec
children 7a19c8d6bb9e
comparison
equal deleted inserted replaced
17848:19be0b17e0b9 17849:73ddc462979d
401 " dict 401 " dict
402 let value = {'key1' : 'value1', 'key2' : ['list', 'value'], 'key3' : {'dict' : 'value'}} 402 let value = {'key1' : 'value1', 'key2' : ['list', 'value'], 'key3' : {'dict' : 'value'}}
403 call assert_equal(string(value), printf('%s', value)) 403 call assert_equal(string(value), printf('%s', value))
404 404
405 " funcref 405 " funcref
406 call assert_equal('printf', printf('%s', function('printf'))) 406 call assert_equal('printf', printf('%s', 'printf'->function()))
407 407
408 " partial 408 " partial
409 call assert_equal(string(function('printf', ['%s'])), printf('%s', function('printf', ['%s']))) 409 call assert_equal(string(function('printf', ['%s'])), printf('%s', function('printf', ['%s'])))
410 endfunc 410 endfunc
411 411
488 func! One() 488 func! One()
489 return 2 489 return 2
490 endfunc 490 endfunc
491 call assert_equal(2, OneByName()) 491 call assert_equal(2, OneByName())
492 call assert_equal(1, OneByRef()) 492 call assert_equal(1, OneByRef())
493 let OneByRef = funcref('One') 493 let OneByRef = 'One'->funcref()
494 call assert_equal(2, OneByRef()) 494 call assert_equal(2, OneByRef())
495 call assert_fails('echo funcref("{")', 'E475:') 495 call assert_fails('echo funcref("{")', 'E475:')
496 endfunc 496 endfunc
497 497
498 func Test_setmatches() 498 func Test_setmatches()