shortmess_spec.lua (2533B)
1 local t = require('test.testutil') 2 local n = require('test.functional.testnvim')() 3 local Screen = require('test.functional.ui.screen') 4 5 local clear = n.clear 6 local command = n.command 7 local eq = t.eq 8 local eval = n.eval 9 local feed = n.feed 10 11 describe("'shortmess'", function() 12 local screen 13 14 before_each(function() 15 clear() 16 screen = Screen.new(42, 5) 17 end) 18 19 describe('"F" flag', function() 20 it('hides :edit fileinfo messages', function() 21 command('set hidden') 22 command('set shortmess-=F') 23 feed(':edit foo<CR>') 24 screen:expect([[ 25 ^ | 26 {1:~ }|*3 27 "foo" [New] | 28 ]]) 29 eq(1, eval('bufnr("%")')) 30 31 command('set shortmess+=F') 32 feed(':edit bar<CR>') 33 screen:expect([[ 34 ^ | 35 {1:~ }|*3 36 :edit bar | 37 ]]) 38 eq(2, eval('bufnr("%")')) 39 end) 40 41 it('hides :bnext, :bprevious fileinfo messages', function() 42 command('set hidden') 43 command('set shortmess-=F') 44 feed(':edit foo<CR>') 45 screen:expect([[ 46 ^ | 47 {1:~ }|*3 48 "foo" [New] | 49 ]]) 50 eq(1, eval('bufnr("%")')) 51 feed(':edit bar<CR>') 52 screen:expect([[ 53 ^ | 54 {1:~ }|*3 55 "bar" [New] | 56 ]]) 57 eq(2, eval('bufnr("%")')) 58 feed(':bprevious<CR>') 59 screen:expect([[ 60 ^ | 61 {1:~ }|*3 62 "foo" [New] --No lines in buffer-- | 63 ]]) 64 eq(1, eval('bufnr("%")')) 65 66 command('set shortmess+=F') 67 feed(':bnext<CR>') 68 screen:expect([[ 69 ^ | 70 {1:~ }|*3 71 :bnext | 72 ]]) 73 eq(2, eval('bufnr("%")')) 74 feed(':bprevious<CR>') 75 screen:expect([[ 76 ^ | 77 {1:~ }|*3 78 :bprevious | 79 ]]) 80 eq(1, eval('bufnr("%")')) 81 end) 82 end) 83 end)