robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

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