shortmess_spec.lua 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. local helpers = require('test.functional.helpers')(after_each)
  2. local Screen = require('test.functional.ui.screen')
  3. local clear = helpers.clear
  4. local command = helpers.command
  5. local eq = helpers.eq
  6. local eval = helpers.eval
  7. local feed = helpers.feed
  8. describe("'shortmess'", function()
  9. local screen
  10. before_each(function()
  11. clear()
  12. screen = Screen.new(42, 5)
  13. screen:attach()
  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. ~ |
  23. ~ |
  24. ~ |
  25. "foo" [New File] |
  26. ]])
  27. eq(1, eval('bufnr("%")'))
  28. command('set shortmess+=F')
  29. feed(':edit bar<CR>')
  30. screen:expect([[
  31. ^ |
  32. ~ |
  33. ~ |
  34. ~ |
  35. :edit bar |
  36. ]])
  37. eq(2, eval('bufnr("%")'))
  38. end)
  39. it('hides :bnext, :bprevious fileinfo messages', function()
  40. command('set hidden')
  41. command('set shortmess-=F')
  42. feed(':edit foo<CR>')
  43. screen:expect([[
  44. ^ |
  45. ~ |
  46. ~ |
  47. ~ |
  48. "foo" [New File] |
  49. ]])
  50. eq(1, eval('bufnr("%")'))
  51. feed(':edit bar<CR>')
  52. screen:expect([[
  53. ^ |
  54. ~ |
  55. ~ |
  56. ~ |
  57. "bar" [New File] |
  58. ]])
  59. eq(2, eval('bufnr("%")'))
  60. feed(':bprevious<CR>')
  61. screen:expect([[
  62. ^ |
  63. ~ |
  64. ~ |
  65. ~ |
  66. "foo" [New file] --No lines in buffer-- |
  67. ]])
  68. eq(1, eval('bufnr("%")'))
  69. command('set shortmess+=F')
  70. feed(':bnext<CR>')
  71. screen:expect([[
  72. ^ |
  73. ~ |
  74. ~ |
  75. ~ |
  76. :bnext |
  77. ]])
  78. eq(2, eval('bufnr("%")'))
  79. feed(':bprevious<CR>')
  80. screen:expect([[
  81. ^ |
  82. ~ |
  83. ~ |
  84. ~ |
  85. :bprevious |
  86. ]])
  87. eq(1, eval('bufnr("%")'))
  88. end)
  89. end)
  90. end)