aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options/shortmess_spec.lua
blob: a56e9c09b4ddbd43d47219cff4e3b59c03df701f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed

describe("'shortmess'", function()
  local screen

  before_each(function()
    clear()
    screen = Screen.new(42, 5)
    screen:attach()
  end)

  describe('"F" flag', function()
    it('hides :edit fileinfo messages', function()
      command('set hidden')
      command('set shortmess-=F')
      feed(':edit foo<CR>')
      screen:expect([[
        ^                                          |
        ~                                         |
        ~                                         |
        ~                                         |
        "foo" [New]                               |
      ]])
      eq(1, eval('bufnr("%")'))

      command('set shortmess+=F')
      feed(':edit bar<CR>')
      screen:expect([[
        ^                                          |
        ~                                         |
        ~                                         |
        ~                                         |
        :edit bar                                 |
      ]])
      eq(2, eval('bufnr("%")'))
    end)

    it('hides :bnext, :bprevious fileinfo messages', function()
      command('set hidden')
      command('set shortmess-=F')
      feed(':edit foo<CR>')
      screen:expect([[
        ^                                          |
        ~                                         |
        ~                                         |
        ~                                         |
        "foo" [New]                               |
      ]])
      eq(1, eval('bufnr("%")'))
      feed(':edit bar<CR>')
      screen:expect([[
        ^                                          |
        ~                                         |
        ~                                         |
        ~                                         |
        "bar" [New]                               |
      ]])
      eq(2, eval('bufnr("%")'))
      feed(':bprevious<CR>')
      screen:expect([[
        ^                                          |
        ~                                         |
        ~                                         |
        ~                                         |
        "foo" [New] --No lines in buffer--        |
      ]])
      eq(1, eval('bufnr("%")'))

      command('set shortmess+=F')
      feed(':bnext<CR>')
      screen:expect([[
        ^                                          |
        ~                                         |
        ~                                         |
        ~                                         |
        :bnext                                    |
      ]])
      eq(2, eval('bufnr("%")'))
      feed(':bprevious<CR>')
      screen:expect([[
        ^                                          |
        ~                                         |
        ~                                         |
        ~                                         |
        :bprevious                                |
      ]])
      eq(1, eval('bufnr("%")'))
    end)
  end)
end)