1" Test the :source! command 2 3source check.vim 4 5func Test_source_utf8() 6 " check that sourcing a script with 0x80 as second byte works 7 new 8 call setline(1, [':%s/àx/--à1234--/g', ':%s/Àx/--À1234--/g']) 9 write! Xscript 10 bwipe! 11 new 12 call setline(1, [' àx ', ' Àx ']) 13 source! Xscript | echo 14 call assert_equal(' --à1234-- ', getline(1)) 15 call assert_equal(' --À1234-- ', getline(2)) 16 bwipe! 17 call delete('Xscript') 18endfunc 19 20func Test_source_latin() 21 " check that sourcing a latin1 script with a 0xc0 byte works 22 new 23 call setline(1, ["call feedkeys('r')", "call feedkeys('\xc0', 'xt')"]) 24 write! Xscript 25 bwipe! 26 new 27 call setline(1, ['xxx']) 28 source Xscript 29 call assert_equal("\u00c0xx", getline(1)) 30 bwipe! 31 call delete('Xscript') 32endfunc 33 34" Test for sourcing a file with CTRL-V's at the end of the line 35func Test_source_ctrl_v() 36 call writefile(['map __1 afirst', 37 \ 'map __2 asecond', 38 \ 'map __3 athird', 39 \ 'map __4 afourth', 40 \ 'map __5 afifth', 41 \ "map __1 asd\<C-V>", 42 \ "map __2 asd\<C-V>\<C-V>", 43 \ "map __3 asd\<C-V>\<C-V>", 44 \ "map __4 asd\<C-V>\<C-V>\<C-V>", 45 \ "map __5 asd\<C-V>\<C-V>\<C-V>", 46 \ ], 'Xtestfile') 47 source Xtestfile 48 enew! 49 exe "normal __1\<Esc>\<Esc>__2\<Esc>__3\<Esc>\<Esc>__4\<Esc>__5\<Esc>" 50 exe "%s/\<C-J>/0/g" 51 call assert_equal(['sd', 52 \ "map __2 asd\<Esc>secondsd\<Esc>sd0map __5 asd0fifth"], 53 \ getline(1, 2)) 54 55 enew! 56 call delete('Xtestfile') 57 unmap __1 58 unmap __2 59 unmap __3 60 unmap __4 61 unmap __5 62endfunc 63 64" vim: shiftwidth=2 sts=2 expandtab 65