007_ball_buffer_list_spec.lua (1911B)
1 -- Test for autocommand that changes the buffer list, when doing ":ball". 2 3 local n = require('test.functional.testnvim')() 4 5 local clear, feed, insert = n.clear, n.feed, n.insert 6 local feed_command, expect = n.feed_command, n.expect 7 8 describe(':ball', function() 9 setup(clear) 10 11 it('is working', function() 12 -- Must disable 'hidden' so that the BufReadPost autocmd is triggered 13 -- when Xxx2 is reloaded 14 feed_command('set nohidden') 15 insert([[ 16 start of test file Xxx 17 this is a test 18 this is a test 19 end of test file Xxx]]) 20 21 feed_command('w! Xxx0') 22 feed('gg') 23 24 -- Write test file Xxx1 25 feed('A1<esc>:.,/end of/w! Xxx1<cr>') 26 feed_command('sp Xxx1') 27 feed_command('close') 28 29 -- Write test file Xxx2 30 feed('$r2:.,/end of/w! Xxx2<cr>') 31 feed_command('sp Xxx2') 32 feed_command('close') 33 34 -- Write test file Xxx3 35 feed('$r3:.,/end of/w! Xxx3<cr>') 36 feed_command('sp Xxx3') 37 feed_command('close') 38 39 feed_command('au BufReadPost Xxx2 bwipe') 40 41 -- Open window for all args, close Xxx2 42 feed('$r4:ball<cr>') 43 44 -- Write contents of this file 45 feed_command('%yank A') 46 47 -- Append contents of second window (Xxx1) 48 feed('') 49 feed_command('%yank A') 50 51 -- Append contents of last window (this file) 52 feed('') 53 feed_command('%yank A') 54 55 feed_command('bf') 56 feed_command('%d') 57 feed_command('0put=@a') 58 feed_command('$d') 59 60 expect([[ 61 start of test file Xxx4 62 this is a test 63 this is a test 64 end of test file Xxx 65 start of test file Xxx1 66 this is a test 67 this is a test 68 end of test file Xxx 69 start of test file Xxx4 70 this is a test 71 this is a test 72 end of test file Xxx]]) 73 end) 74 75 teardown(function() 76 os.remove('Xxx0') 77 os.remove('Xxx1') 78 os.remove('Xxx2') 79 os.remove('Xxx3') 80 end) 81 end)