forked from aniani/vim
patch 8.1.2013: more functions can be used as methods
Problem: More functions can be used as methods. Solution: Make various functions usable as a method.
This commit is contained in:
@@ -266,7 +266,7 @@ endfunc
|
||||
func s:normalize_fname(fname)
|
||||
let ret = substitute(a:fname, '\', '/', 'g')
|
||||
let ret = substitute(ret, '//', '/', 'g')
|
||||
return tolower(ret)
|
||||
return ret->tolower()
|
||||
endfunc
|
||||
|
||||
func Test_resolve_win32()
|
||||
@@ -505,7 +505,7 @@ func Test_toupper()
|
||||
\ toupper(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'))
|
||||
|
||||
" Test with a few lowercase diacritics.
|
||||
call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("aàáâãäåāăąǎǟǡả"))
|
||||
call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", "aàáâãäåāăąǎǟǡả"->toupper())
|
||||
call assert_equal("BḂḆ", toupper("bḃḇ"))
|
||||
call assert_equal("CÇĆĈĊČ", toupper("cçćĉċč"))
|
||||
call assert_equal("DĎĐḊḎḐ", toupper("dďđḋḏḑ"))
|
||||
@@ -568,6 +568,11 @@ func Test_toupper()
|
||||
call toupper("123\xC0\x80\xC0")
|
||||
endfunc
|
||||
|
||||
func Test_tr()
|
||||
call assert_equal('foo', tr('bar', 'bar', 'foo'))
|
||||
call assert_equal('zxy', 'cab'->tr('abc', 'xyz'))
|
||||
endfunc
|
||||
|
||||
" Tests for the mode() function
|
||||
let current_modes = ''
|
||||
func Save_mode()
|
||||
@@ -1203,7 +1208,7 @@ endfunc
|
||||
|
||||
func Test_trim()
|
||||
call assert_equal("Testing", trim(" \t\r\r\x0BTesting \t\n\r\n\t\x0B\x0B"))
|
||||
call assert_equal("Testing", trim(" \t \r\r\n\n\x0BTesting \t\n\r\n\t\x0B\x0B"))
|
||||
call assert_equal("Testing", " \t \r\r\n\n\x0BTesting \t\n\r\n\t\x0B\x0B"->trim())
|
||||
call assert_equal("RESERVE", trim("xyz \twwRESERVEzyww \t\t", " wxyz\t"))
|
||||
call assert_equal("wRE \tSERVEzyww", trim("wRE \tSERVEzyww"))
|
||||
call assert_equal("abcd\t xxxx tail", trim(" \tabcd\t xxxx tail"))
|
||||
@@ -1617,7 +1622,7 @@ func Test_bufadd_bufload()
|
||||
call assert_equal([''], getbufline(buf, 1, '$'))
|
||||
|
||||
let curbuf = bufnr('')
|
||||
call writefile(['some', 'text'], 'XotherName')
|
||||
eval ['some', 'text']->writefile('XotherName')
|
||||
let buf = 'XotherName'->bufadd()
|
||||
call assert_notequal(0, buf)
|
||||
eval 'XotherName'->bufexists()->assert_equal(1)
|
||||
|
Reference in New Issue
Block a user