shortmess_spec.lua 2.5 KB

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