comparison src/testdir/test_functions.vim @ 15607:2dcaa860e3fc v8.1.0811

patch 8.1.0811: too many #ifdefs commit https://github.com/vim/vim/commit/30276f2beb248557c6b33cd5418bca8b7084b0a5 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 24 17:59:39 2019 +0100 patch 8.1.0811: too many #ifdefs Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, the final chapter.
author Bram Moolenaar <Bram@vim.org>
date Thu, 24 Jan 2019 18:00:07 +0100
parents 67e3103d6e18
children e649df212461
comparison
equal deleted inserted replaced
15606:50e09796a00a 15607:2dcaa860e3fc
104 call assert_equal(1, strwidth("\t")) 104 call assert_equal(1, strwidth("\t"))
105 call assert_equal(3, strwidth('Vim')) 105 call assert_equal(3, strwidth('Vim'))
106 call assert_equal(4, strwidth(1234)) 106 call assert_equal(4, strwidth(1234))
107 call assert_equal(5, strwidth(-1234)) 107 call assert_equal(5, strwidth(-1234))
108 108
109 if has('multi_byte') 109 call assert_equal(2, strwidth('😉'))
110 call assert_equal(2, strwidth('😉')) 110 call assert_equal(17, strwidth('Eĥoŝanĝo ĉiuĵaŭde'))
111 call assert_equal(17, strwidth('Eĥoŝanĝo ĉiuĵaŭde')) 111 call assert_equal((aw == 'single') ? 6 : 7, strwidth('Straße'))
112 call assert_equal((aw == 'single') ? 6 : 7, strwidth('Straße'))
113 endif
114 112
115 call assert_fails('call strwidth({->0})', 'E729:') 113 call assert_fails('call strwidth({->0})', 'E729:')
116 call assert_fails('call strwidth([])', 'E730:') 114 call assert_fails('call strwidth([])', 'E730:')
117 call assert_fails('call strwidth({})', 'E731:') 115 call assert_fails('call strwidth({})', 'E731:')
118 call assert_fails('call strwidth(1.2)', 'E806:') 116 call assert_fails('call strwidth(1.2)', 'E806:')
275 call assert_equal('ab', strpart('abcdefg', -2, 4)) 273 call assert_equal('ab', strpart('abcdefg', -2, 4))
276 call assert_equal('abcdefg', strpart('abcdefg', -2)) 274 call assert_equal('abcdefg', strpart('abcdefg', -2))
277 call assert_equal('fg', strpart('abcdefg', 5, 4)) 275 call assert_equal('fg', strpart('abcdefg', 5, 4))
278 call assert_equal('defg', strpart('abcdefg', 3)) 276 call assert_equal('defg', strpart('abcdefg', 3))
279 277
280 if has('multi_byte') 278 call assert_equal('lép', strpart('éléphant', 2, 4))
281 call assert_equal('lép', strpart('éléphant', 2, 4)) 279 call assert_equal('léphant', strpart('éléphant', 2))
282 call assert_equal('léphant', strpart('éléphant', 2))
283 endif
284 endfunc 280 endfunc
285 281
286 func Test_tolower() 282 func Test_tolower()
287 call assert_equal("", tolower("")) 283 call assert_equal("", tolower(""))
288 284
289 " Test with all printable ASCII characters. 285 " Test with all printable ASCII characters.
290 call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~', 286 call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~',
291 \ tolower(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~')) 287 \ tolower(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'))
292
293 if !has('multi_byte')
294 return
295 endif
296 288
297 " Test with a few uppercase diacritics. 289 " Test with a few uppercase diacritics.
298 call assert_equal("aàáâãäåāăąǎǟǡả", tolower("AÀÁÂÃÄÅĀĂĄǍǞǠẢ")) 290 call assert_equal("aàáâãäåāăąǎǟǡả", tolower("AÀÁÂÃÄÅĀĂĄǍǞǠẢ"))
299 call assert_equal("bḃḇ", tolower("BḂḆ")) 291 call assert_equal("bḃḇ", tolower("BḂḆ"))
300 call assert_equal("cçćĉċč", tolower("CÇĆĈĊČ")) 292 call assert_equal("cçćĉċč", tolower("CÇĆĈĊČ"))
365 call assert_equal("", toupper("")) 357 call assert_equal("", toupper(""))
366 358
367 " Test with all printable ASCII characters. 359 " Test with all printable ASCII characters.
368 call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~', 360 call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~',
369 \ toupper(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~')) 361 \ toupper(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'))
370
371 if !has('multi_byte')
372 return
373 endif
374 362
375 " Test with a few lowercase diacritics. 363 " Test with a few lowercase diacritics.
376 call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("aàáâãäåāăąǎǟǡả")) 364 call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("aàáâãäåāăąǎǟǡả"))
377 call assert_equal("BḂḆ", toupper("bḃḇ")) 365 call assert_equal("BḂḆ", toupper("bḃḇ"))
378 call assert_equal("CÇĆĈĊČ", toupper("cçćĉċč")) 366 call assert_equal("CÇĆĈĊČ", toupper("cçćĉċč"))