1 2func Test_yank_shows_register() 3 enew 4 set report=0 5 call setline(1, ['foo', 'bar']) 6 " Line-wise 7 exe 'norm! yy' 8 call assert_equal('1 line yanked', v:statusmsg) 9 exe 'norm! "zyy' 10 call assert_equal('1 line yanked into "z', v:statusmsg) 11 exe 'norm! yj' 12 call assert_equal('2 lines yanked', v:statusmsg) 13 exe 'norm! "zyj' 14 call assert_equal('2 lines yanked into "z', v:statusmsg) 15 16 " Block-wise 17 exe "norm! \<C-V>y" 18 call assert_equal('block of 1 line yanked', v:statusmsg) 19 exe "norm! \<C-V>\"zy" 20 call assert_equal('block of 1 line yanked into "z', v:statusmsg) 21 exe "norm! \<C-V>jy" 22 call assert_equal('block of 2 lines yanked', v:statusmsg) 23 exe "norm! \<C-V>j\"zy" 24 call assert_equal('block of 2 lines yanked into "z', v:statusmsg) 25 26 bwipe! 27endfunc 28 29func Test_display_registers() 30 e file1 31 e file2 32 call setline(1, ['foo', 'bar']) 33 /bar 34 exe 'norm! y2l"axx' 35 call feedkeys("i\<C-R>=2*4\n\<esc>") 36 call feedkeys(":ls\n", 'xt') 37 38 let a = execute('display') 39 let b = execute('registers') 40 41 call assert_equal(a, b) 42 call assert_match('^\n--- Registers ---\n' 43 \ . '"" a\n' 44 \ . '"0 ba\n' 45 \ . '"1 b\n' 46 \ . '"a b\n' 47 \ . '.*' 48 \ . '"- a\n' 49 \ . '.*' 50 \ . '": ls\n' 51 \ . '"% file2\n' 52 \ . '"# file1\n' 53 \ . '"/ bar\n' 54 \ . '"= 2\*4', a) 55 56 let a = execute('registers a') 57 call assert_match('^\n--- Registers ---\n' 58 \ . '"a b', a) 59 60 let a = execute('registers :') 61 call assert_match('^\n--- Registers ---\n' 62 \ . '": ls', a) 63 64 bwipe! 65endfunc 66