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