robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
0a7201095b
master
1" Tests for parsing the modeline. 2 3source check.vim 4 5func Test_modeline_invalid () 6" This was reading allocated memory in the past. 7call writefile ([ 'vi:0' , 'nothing' ], 'Xmodeline' ) 8let modeline = & modeline 9set modeline 10call assert_fails ( 'split Xmodeline' , 'E518:' ) 11 12" Missing end colon (ignored). 13call writefile ([ '// vim: set ts=2' ], 'Xmodeline' ) 14edit Xmodeline_version 15call assert_equal ( 8 , & ts ) 16bwipe ! 17 18" Missing colon at beginning (ignored). 19call writefile ([ '// vim set ts=2:' ], 'Xmodeline' ) 20edit Xmodeline_version 21call assert_equal ( 8 , & ts ) 22bwipe ! 23 24" Missing space after vim (ignored). 25call writefile ([ '// vim:ts=2:' ], 'Xmodeline' ) 26edit Xmodeline_version 27call assert_equal ( 8 , & ts ) 28bwipe ! 29 30let & modeline = modeline 31bwipe ! 32call delete ( 'Xmodeline' ) 33endfunc 34 35func Test_modeline_filetype () 36call writefile ([ 'vim: set ft=c :' , 'nothing' ], 'Xmodeline_filetype' ) 37let modeline = & modeline 38set modeline 39filetype plugin on 40split Xmodeline_filetype 41call assert_equal ( "c" , & filetype ) 42call assert_equal ( 1 , b: did_ftplugin ) 43call assert_equal ( "ccomplete#Complete" , & ofu ) 44 45bwipe ! 46call delete ( 'Xmodeline_filetype' ) 47let & modeline = modeline 48filetype plugin off 49endfunc 50 51func Test_modeline_syntax () 52call writefile ([ 'vim: set syn=c :' , 'nothing' ], 'Xmodeline_syntax' ) 53let modeline = & modeline 54set modeline 55syntax enable 56split Xmodeline_syntax 57call assert_equal ( "c" , & syntax ) 58call assert_equal ( "c" , b: current_syntax ) 59 60bwipe ! 61call delete ( 'Xmodeline_syntax' ) 62let & modeline = modeline 63syntax off 64endfunc 65 66func Test_modeline_keymap () 67if ! has ( 'keymap' ) 68return 69endif 70call writefile ([ 'vim: set keymap=greek :' , 'nothing' ], 'Xmodeline_keymap' ) 71let modeline = & modeline 72set modeline 73split Xmodeline_keymap 74call assert_equal ( "greek" , & keymap ) 75call assert_match ( 'greek\|grk' , b: keymap_name ) 76 77bwipe ! 78call delete ( 'Xmodeline_keymap' ) 79let & modeline = modeline 80set keymap = iminsert = 0 imsearch = -1 81endfunc 82 83func Test_modeline_version () 84let modeline = & modeline 85set modeline 86 87" Test with vim:{vers}: (version {vers} or later). 88call writefile ([ '// vim' .. v: version .. ': ts=2:' ], 'Xmodeline_version' ) 89edit Xmodeline_version 90call assert_equal ( 2 , & ts ) 91bwipe ! 92 93call writefile ([ '// vim' .. ( v: version - 100 ) .. ': ts=2:' ], 'Xmodeline_version' ) 94edit Xmodeline_version 95call assert_equal ( 2 , & ts ) 96bwipe ! 97 98call writefile ([ '// vim' .. ( v: version + 100 ) .. ': ts=2:' ], 'Xmodeline_version' ) 99edit Xmodeline_version 100call assert_equal ( 8 , & ts ) 101bw ! 102 103" Test with vim>{vers}: (version after {vers}). 104call writefile ([ '// vim>' .. v: version .. ': ts=2:' ], 'Xmodeline_version' ) 105edit Xmodeline_version 106call assert_equal ( 8 , & ts ) 107bwipe ! 108 109call writefile ([ '// vim>' .. ( v: version - 100 ) .. ': ts=2:' ], 'Xmodeline_version' ) 110edit Xmodeline_version 111call assert_equal ( 2 , & ts ) 112bwipe ! 113 114call writefile ([ '// vim>' .. ( v: version + 100 ) .. ': ts=2:' ], 'Xmodeline_version' ) 115edit Xmodeline_version 116call assert_equal ( 8 , & ts ) 117bwipe ! 118 119" Test with vim<{vers}: (version before {vers}). 120call writefile ([ '// vim<' .. v: version .. ': ts=2:' ], 'Xmodeline_version' ) 121edit Xmodeline_version 122call assert_equal ( 8 , & ts ) 123bwipe ! 124 125call writefile ([ '// vim<' .. ( v: version - 100 ) .. ': ts=2:' ], 'Xmodeline_version' ) 126edit Xmodeline_version 127call assert_equal ( 8 , & ts ) 128bwipe ! 129 130call writefile ([ '// vim<' .. ( v: version + 100 ) .. ': ts=2:' ], 'Xmodeline_version' ) 131edit Xmodeline_version 132call assert_equal ( 2 , & ts ) 133bwipe ! 134 135" Test with vim={vers}: (version {vers} only). 136call writefile ([ '// vim=' .. v: version .. ': ts=2:' ], 'Xmodeline_version' ) 137edit Xmodeline_version 138call assert_equal ( 2 , & ts ) 139bwipe ! 140 141call writefile ([ '// vim=' .. ( v: version - 100 ) .. ': ts=2:' ], 'Xmodeline_version' ) 142edit Xmodeline_version 143call assert_equal ( 8 , & ts ) 144bwipe ! 145 146call writefile ([ '// vim=' .. ( v: version + 100 ) .. ': ts=2:' ], 'Xmodeline_version' ) 147edit Xmodeline_version 148call assert_equal ( 8 , & ts ) 149bwipe ! 150 151let & modeline = modeline 152call delete ( 'Xmodeline_version' ) 153endfunc 154 155func Test_modeline_colon () 156let modeline = & modeline 157set modeline 158 159call writefile ([ '// vim: set showbreak=\: ts=2: sw=2' ], 'Xmodeline_colon' ) 160edit Xmodeline_colon 161 162" backlash colon should become colon. 163call assert_equal ( ':' , & showbreak ) 164 165" 'ts' should be set. 166" 'sw' should be ignored because it is after the end colon. 167call assert_equal ( 2 , & ts ) 168call assert_equal ( 8 , & sw ) 169 170let & modeline = modeline 171call delete ( 'Xmodeline_colon' ) 172endfunc 173 174func s: modeline_fails ( what , text , error ) 175" Don't use CheckOption(), it would skip the whole test 176" just for a single un-supported option 177if ! exists ( '+' .. a: what ) 178return 179endif 180let fname = "Xmodeline_fails_" . a: what 181call writefile ([ 'vim: set ' . a: text . ' :' , 'nothing' ], fname ) 182let modeline = & modeline 183set modeline 184filetype plugin on 185syntax enable 186call assert_fails ( 'split ' . fname , a: error ) 187call assert_equal ( "" , & filetype ) 188call assert_equal ( "" , & syntax ) 189 190bwipe ! 191call delete ( fname ) 192let & modeline = modeline 193filetype plugin off 194syntax off 195endfunc 196 197func Test_modeline_filetype_fails () 198call s: modeline_fails ( 'filetype' , 'ft=evil$CMD' , 'E474:' ) 199endfunc 200 201func Test_modeline_syntax_fails () 202call s: modeline_fails ( 'syntax' , 'syn=evil$CMD' , 'E474:' ) 203endfunc 204 205func Test_modeline_keymap_fails () 206call s: modeline_fails ( 'keymap' , 'keymap=evil$CMD' , 'E474:' ) 207endfunc 208 209func Test_modeline_fails_always () 210call s: modeline_fails ( 'backupdir' , 'backupdir=Something()' , 'E520:' ) 211call s: modeline_fails ( 'cdpath' , 'cdpath=Something()' , 'E520:' ) 212call s: modeline_fails ( 'charconvert' , 'charconvert=Something()' , 'E520:' ) 213call s: modeline_fails ( 'completefunc' , 'completefunc=Something()' , 'E520:' ) 214call s: modeline_fails ( 'cscopeprg' , 'cscopeprg=Something()' , 'E520:' ) 215call s: modeline_fails ( 'diffexpr' , 'diffexpr=Something()' , 'E520:' ) 216call s: modeline_fails ( 'directory' , 'directory=Something()' , 'E520:' ) 217call s: modeline_fails ( 'equalprg' , 'equalprg=Something()' , 'E520:' ) 218call s: modeline_fails ( 'errorfile' , 'errorfile=Something()' , 'E520:' ) 219call s: modeline_fails ( 'exrc' , 'exrc=Something()' , 'E520:' ) 220call s: modeline_fails ( 'findfunc' , 'findfunc=Something' , 'E520:' ) 221call s: modeline_fails ( 'formatprg' , 'formatprg=Something()' , 'E520:' ) 222call s: modeline_fails ( 'fsync' , 'fsync=Something()' , 'E520:' ) 223call s: modeline_fails ( 'grepprg' , 'grepprg=Something()' , 'E520:' ) 224call s: modeline_fails ( 'helpfile' , 'helpfile=Something()' , 'E520:' ) 225call s: modeline_fails ( 'imactivatefunc' , 'imactivatefunc=Something()' , 'E520:' ) 226call s: modeline_fails ( 'imstatusfunc' , 'imstatusfunc=Something()' , 'E520:' ) 227call s: modeline_fails ( 'imstyle' , 'imstyle=Something()' , 'E520:' ) 228call s: modeline_fails ( 'keywordprg' , 'keywordprg=Something()' , 'E520:' ) 229call s: modeline_fails ( 'langmap' , 'langmap=Something()' , 'E520:' ) 230call s: modeline_fails ( 'luadll' , 'luadll=Something()' , 'E520:' ) 231call s: modeline_fails ( 'makeef' , 'makeef=Something()' , 'E520:' ) 232call s: modeline_fails ( 'makeprg' , 'makeprg=Something()' , 'E520:' ) 233call s: modeline_fails ( 'mkspellmem' , 'mkspellmem=Something()' , 'E520:' ) 234call s: modeline_fails ( 'mzschemedll' , 'mzschemedll=Something()' , 'E520:' ) 235call s: modeline_fails ( 'mzschemegcdll' , 'mzschemegcdll=Something()' , 'E520:' ) 236call s: modeline_fails ( 'modelineexpr' , 'modelineexpr' , 'E520:' ) 237call s: modeline_fails ( 'omnifunc' , 'omnifunc=Something()' , 'E520:' ) 238call s: modeline_fails ( 'operatorfunc' , 'operatorfunc=Something()' , 'E520:' ) 239call s: modeline_fails ( 'perldll' , 'perldll=Something()' , 'E520:' ) 240call s: modeline_fails ( 'printdevice' , 'printdevice=Something()' , 'E520:' ) 241call s: modeline_fails ( 'patchexpr' , 'patchexpr=Something()' , 'E520:' ) 242call s: modeline_fails ( 'printexpr' , 'printexpr=Something()' , 'E520:' ) 243call s: modeline_fails ( 'pythondll' , 'pythondll=Something()' , 'E520:' ) 244call s: modeline_fails ( 'pythonhome' , 'pythonhome=Something()' , 'E520:' ) 245call s: modeline_fails ( 'pythonthreedll' , 'pythonthreedll=Something()' , 'E520:' ) 246call s: modeline_fails ( 'pythonthreehome' , 'pythonthreehome=Something()' , 'E520:' ) 247call s: modeline_fails ( 'pyxversion' , 'pyxversion=Something()' , 'E520:' ) 248call s: modeline_fails ( 'rubydll' , 'rubydll=Something()' , 'E520:' ) 249call s: modeline_fails ( 'runtimepath' , 'runtimepath=Something()' , 'E520:' ) 250call s: modeline_fails ( 'secure' , 'secure=Something()' , 'E520:' ) 251call s: modeline_fails ( 'shell' , 'shell=Something()' , 'E520:' ) 252call s: modeline_fails ( 'shellcmdflag' , 'shellcmdflag=Something()' , 'E520:' ) 253call s: modeline_fails ( 'shellpipe' , 'shellpipe=Something()' , 'E520:' ) 254call s: modeline_fails ( 'shellquote' , 'shellquote=Something()' , 'E520:' ) 255call s: modeline_fails ( 'shellredir' , 'shellredir=Something()' , 'E520:' ) 256call s: modeline_fails ( 'shellxquote' , 'shellxquote=Something()' , 'E520:' ) 257call s: modeline_fails ( 'spellfile' , 'spellfile=Something()' , 'E520:' ) 258call s: modeline_fails ( 'spellsuggest' , 'spellsuggest=Something()' , 'E520:' ) 259call s: modeline_fails ( 'tcldll' , 'tcldll=Something()' , 'E520:' ) 260call s: modeline_fails ( 'titleold' , 'titleold=Something()' , 'E520:' ) 261call s: modeline_fails ( 'viewdir' , 'viewdir=Something()' , 'E520:' ) 262call s: modeline_fails ( 'viminfo' , 'viminfo=Something()' , 'E520:' ) 263call s: modeline_fails ( 'viminfofile' , 'viminfofile=Something()' , 'E520:' ) 264call s: modeline_fails ( 'winptydll' , 'winptydll=Something()' , 'E520:' ) 265call s: modeline_fails ( 'undodir' , 'undodir=Something()' , 'E520:' ) 266" only check a few terminal options 267" Skip these since nvim doesn't support termcodes as options 268"call s:modeline_fails('t_AB', 't_AB=Something()', 'E520:') 269"call s:modeline_fails('t_ce', 't_ce=Something()', 'E520:') 270"call s:modeline_fails('t_sr', 't_sr=Something()', 'E520:') 271"call s:modeline_fails('t_8b', 't_8b=Something()', 'E520:') 272endfunc 273 274func Test_modeline_fails_modelineexpr () 275call s: modeline_fails ( 'balloonexpr' , 'balloonexpr=Something()' , 'E992:' ) 276call s: modeline_fails ( 'complete' , "complete=FSomething" , 'E992:' ) 277call s: modeline_fails ( 'foldexpr' , 'foldexpr=Something()' , 'E992:' ) 278call s: modeline_fails ( 'foldtext' , 'foldtext=Something()' , 'E992:' ) 279call s: modeline_fails ( 'formatexpr' , 'formatexpr=Something()' , 'E992:' ) 280call s: modeline_fails ( 'guitablabel' , 'guitablabel=Something()' , 'E992:' ) 281call s: modeline_fails ( 'guitabtooltip' , 'guitabtooltip=Something()' , 'E992:' ) 282call s: modeline_fails ( 'iconstring' , 'iconstring=Something()' , 'E992:' ) 283call s: modeline_fails ( 'includeexpr' , 'includeexpr=Something()' , 'E992:' ) 284call s: modeline_fails ( 'indentexpr' , 'indentexpr=Something()' , 'E992:' ) 285call s: modeline_fails ( 'printheader' , 'printheader=Something()' , 'E992:' ) 286call s: modeline_fails ( 'rulerformat' , 'rulerformat=Something()' , 'E992:' ) 287call s: modeline_fails ( 'statusline' , 'statusline=Something()' , 'E992:' ) 288call s: modeline_fails ( 'tabline' , 'tabline=Something()' , 'E992:' ) 289call s: modeline_fails ( 'titlestring' , 'titlestring=Something()' , 'E992:' ) 290endfunc 291 292func Test_modeline_complete_uses_sandbox () 293let modeline = & modeline 294let modelineexpr = & modelineexpr 295 296func ! ModelineCompletePwnFindstart ( findstart , base ) 297if a: findstart 298call writefile ([ 'findstart' ], 'Xmodeline_complete_proof' ) 299return 0 300endif 301return [ 'match' ] 302endfunc 303 304func ! ModelineCompletePwnMatches ( findstart , base ) 305if a: findstart 306return 0 307endif 308call writefile ([ 'matches' ], 'Xmodeline_complete_proof' ) 309return [ 'match' ] 310endfunc 311 312try 313set modeline modelineexpr 314 315call writefile ([ 316 \'vim: set complete=FModelineCompletePwnFindstart :' , 317 \'body' , 318 \], 'Xmodeline_complete_attack' , 'D' ) 319call delete ( 'Xmodeline_complete_proof' ) 320edit Xmodeline_complete_attack 321call cursor ( 2 , 1 ) 322call assert_fails ( 'call feedkeys("i\<C-N>\<Esc>", "xt")' , 'E48:' ) 323call assert_false ( filereadable ( 'Xmodeline_complete_proof' )) 324bwipe ! 325 326call writefile ([ 327 \'vim: set complete=FModelineCompletePwnMatches :' , 328 \'body' , 329 \], 'Xmodeline_complete_attack' , 'D' ) 330call delete ( 'Xmodeline_complete_proof' ) 331edit Xmodeline_complete_attack 332call cursor ( 2 , 1 ) 333call assert_fails ( 'call feedkeys("i\<C-N>\<Esc>", "xt")' , 'E48:' ) 334call assert_false ( filereadable ( 'Xmodeline_complete_proof' )) 335bwipe ! 336finally 337let & modeline = modeline 338let & modelineexpr = modelineexpr 339call delete ( 'Xmodeline_complete_proof' ) 340delfunc ModelineCompletePwnFindstart 341delfunc ModelineCompletePwnMatches 342endtry 343endfunc 344 345func Test_modeline_setoption_verbose () 346let modeline = & modeline 347set modeline 348 349let lines =<< trim END 3501 vim:ts=2 3512 two 3523 three 3534 four 3545 five 3556 six 3567 seven 3578 eight 358END 359call writefile ( lines , 'Xmodeline' ) 360edit Xmodeline 361let info = split ( execute ( 'verbose set tabstop?' ), "\n" ) 362call assert_match ( '^\s*Last set from modeline line 1$' , info [ -1 ]) 363bwipe ! 364 365let lines =<< trim END 3661 one 3672 two 3683 three 3694 vim:ts=4 3705 five 3716 six 3727 seven 3738 eight 374END 375call writefile ( lines , 'Xmodeline' ) 376edit Xmodeline 377let info = split ( execute ( 'verbose set tabstop?' ), "\n" ) 378call assert_match ( '^\s*Last set from modeline line 4$' , info [ -1 ]) 379bwipe ! 380 381let lines =<< trim END 3821 one 3832 two 3843 three 3854 four 3865 five 3876 six 3887 seven 3898 vim:ts=8 390END 391call writefile ( lines , 'Xmodeline' ) 392edit Xmodeline 393let info = split ( execute ( 'verbose set tabstop?' ), "\n" ) 394call assert_match ( '^\s*Last set from modeline line 8$' , info [ -1 ]) 395bwipe ! 396 397let & modeline = modeline 398call delete ( 'Xmodeline' ) 399endfunc 400 401" Test for the 'modeline' default value in compatible and non-compatible modes 402" for root and non-root accounts 403func Test_modeline_default () 404" set compatible 405" call assert_false(&modeline) 406set nocompatible 407call assert_equal ( IsRoot () ? 0 : 1 , & modeline ) 408" set compatible&vi 409" call assert_false(&modeline) 410set compatible & vim 411call assert_equal ( IsRoot () ? 0 : 1 , & modeline ) 412set compatible & modeline & 413endfunc 414 415" Some options cannot be set from the modeline when 'diff' option is set 416func Test_modeline_diff_buffer () 417call writefile ([ 'vim: diff foldmethod=marker wrap' ], 'Xmdifile' , 'D' ) 418set foldmethod & nowrap 419new Xmdifile 420call assert_equal ( 'manual' , & foldmethod ) 421call assert_false ( & wrap ) 422set wrap & 423bw 424endfunc 425 426func Test_modeline_disable () 427set modeline 428call writefile ([ 'vim: sw=2' , 'vim: nomodeline' , 'vim: sw=3' ], 'Xmodeline_disable' , 'D' ) 429edit Xmodeline_disable 430call assert_equal ( 2 , & sw ) 431endfunc 432 433" If 'nowrap' is set from a modeline, '>' is used forcibly as lcs-extends. 434func Test_modeline_nowrap_lcs_extends () 435call writefile ([ 436 \'aaa' , 437 \'bbb' , 438 \'ccc evil' , 439 \'ddd vim: nowrap' , 440 \], 'Xmodeline_nowrap' , 'D' ) 441set noequalalways 44211 new |20 vsplit 443 444func Check_modeline_nowrap ( expect_insecure , expect_secure , set_cmd ) 445edit Xmodeline_nowrap 446call assert_equal ( a: expect_insecure , ScreenLines ([ 1 , 5 ], 20 )) 447 4485 split 449call assert_equal ( a: expect_insecure , ScreenLines ([ 1 , 5 ], 20 )) 450call assert_equal ( a: expect_insecure , ScreenLines ([ 7 , 11 ], 20 )) 451 452exe a: set_cmd 'nowrap' 453call assert_equal ( a: expect_secure , ScreenLines ([ 1 , 5 ], 20 )) 454call assert_equal ( a: expect_insecure , ScreenLines ([ 7 , 11 ], 20 )) 455 456close 457call assert_equal ( a: expect_insecure , ScreenLines ([ 1 , 5 ], 20 )) 458 459setglobal nowrap 460call assert_equal ( a: expect_insecure , ScreenLines ([ 1 , 5 ], 20 )) 461setglobal wrap 462call assert_equal ( a: expect_insecure , ScreenLines ([ 1 , 5 ], 20 )) 463 464exe a: set_cmd 'nowrap' 465call assert_equal ( a: expect_secure , ScreenLines ([ 1 , 5 ], 20 )) 466 467exe 'sandbox' a: set_cmd 'nowrap' 468call assert_equal ( a: expect_insecure , ScreenLines ([ 1 , 5 ], 20 )) 469 470exe a: set_cmd 'nowrap' 471call assert_equal ( a: expect_secure , ScreenLines ([ 1 , 5 ], 20 )) 472endfunc 473 474setlocal nolist listchars = 475let expect_insecure = [ 476 \'aaa ' , 477 \'bbb ' , 478 \'ccc >' , 479 \'ddd >' , 480 \'~ ' , 481 \] 482let expect_secure = [ 483 \'aaa ' , 484 \'bbb ' , 485 \'ccc ' , 486 \'ddd ' , 487 \'~ ' , 488 \] 489call Check_modeline_nowrap ( expect_insecure , expect_secure , 'setlocal' ) 490call Check_modeline_nowrap ( expect_insecure , expect_secure , 'set' ) 491 492setlocal list listchars = extends:+ 493let expect_secure = [ 494 \'aaa ' , 495 \'bbb ' , 496 \'ccc +' , 497 \'ddd +' , 498 \'~ ' , 499 \] 500call assert_equal ( expect_secure , ScreenLines ([ 1 , 5 ], 20 )) 501call Check_modeline_nowrap ( expect_insecure , expect_secure , 'setlocal' ) 502call Check_modeline_nowrap ( expect_insecure , expect_secure , 'set' ) 503 504" Other 'listchars' flags are not affected. 505call writefile ([ 506 \"aa\ta" , 507 \"bb\tb" , 508 \"cc\tc evil" , 509 \"dd\td vim: nowrap lcs=tab\\:<->" , 510 \], 'Xmodeline_nowrap' ) 511let expect_insecure = [ 512 \'aa<---->a ' , 513 \'bb<---->b ' , 514 \'cc<---->c >' , 515 \'dd<---->d >' , 516 \'~ ' , 517 \] 518let expect_secure = [ 519 \'aa<---->a ' , 520 \'bb<---->b ' , 521 \'cc<---->c ' , 522 \'dd<---->d ' , 523 \'~ ' , 524 \] 525call Check_modeline_nowrap ( expect_insecure , expect_secure , 'setlocal' ) 526call Check_modeline_nowrap ( expect_insecure , expect_secure , 'set' ) 527 528" Same behavior even if modeline sets "extends" to a space. 529call writefile ([ 530 \"aa\ta" , 531 \"bb\tb" , 532 \"cc\tc evil" , 533 \"dd\td vim: nowrap lcs=tab\\:<->" , 534 \], 'Xmodeline_nowrap' ) 535call Check_modeline_nowrap ( expect_insecure , expect_secure , 'setlocal' ) 536call Check_modeline_nowrap ( expect_insecure , expect_secure , 'set' ) 537 538sandbox setglobal nowrap 539setglobal list listchars=eol:$ 540setlocal bufhidden = wipe 541enew ! 542call setline ( 1 , [ 'aaa bbb' ]) 543call assert_equal ([ 'aaa >' ], ScreenLines ( 1 , 20 )) 544setglobal nowrap 545call assert_equal ([ 'aaa >' ], ScreenLines ( 1 , 20 )) 546setlocal nowrap 547call assert_equal ([ 'aaa ' ], ScreenLines ( 1 , 20 )) 548normal ! 20zl 549call assert_equal ([ ' bbb$ ' ], ScreenLines ( 1 , 20 )) 550setlocal bufhidden = wipe 551enew ! 552call setline ( 1 , [ 'ccc ddd' ]) 553call assert_equal ([ 'ccc ' ], ScreenLines ( 1 , 20 )) 554normal ! 20zl 555call assert_equal ([ ' ddd$ ' ], ScreenLines ( 1 , 20 )) 556 557bwipe ! 558delfunc Check_modeline_nowrap 559set equalalways & 560endfunc 561 562" vim: shiftwidth=2 sts=2 expandtab