robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1-- Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set. 2-- Also test that dv_ works correctly 3 4local n =require ( 'test.functional.testnvim' )() 5local t =require ( 'test.testutil' ) 6 7local describe , it , setup =t . describe , t . it , t . setup 8local feed , insert =n . feed , n . insert 9local clear , feed_command , expect =n . clear , n . feed_command , n . expect 10 11describe ( [[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]] , function () 12setup ( clear ) 13 14-- luacheck: ignore 621 (Indentation) 15it ( 'is working' , function () 16insert ( [[ 17start text 18some test text 19test text 20other test text 21a cde 22f ghi 23test text 24Second line beginning with whitespace]] ) 25 26feed_command ( 'set smarttab expandtab ts=8 sw=4' ) 27-- Make sure that backspace works, no matter what termcap is used. 28feed_command ( 'set t_kD=x7f t_kb=x08' ) 29 30feed_command ( '/some' ) 31feed ( 'r ' ) 32feed_command ( 'set noexpandtab' ) 33feed_command ( '/other' ) 34feed ( 'r <cr>' ) 35-- Test replacing with Tabs and then backspacing to undo it. 36feed ( '0wR <bs><bs><bs><esc><cr>' ) 37-- Test replacing with Tabs. 38feed ( '0wR <esc><cr>' ) 39-- Test that copyindent works with expandtab set. 40feed_command ( 'set expandtab smartindent copyindent ts=8 sw=8 sts=8' ) 41feed ( 'o{<cr>x<esc>' ) 42feed_command ( 'set nosol' ) 43feed_command ( '/Second line/' ) 44-- Test "dv_" 45feed ( 'fwdv_' ) 46 47-- Assert buffer contents. 48expect ( [[ 49start text 50ome test text 51test text 52ther test text 53a cde 54hi 55test text 56{ 57x 58with whitespace]] ) 59end ) 60end )