options_spec.lua 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. -- See also: src/nvim/testdir/test_options.vim
  2. local helpers = require('test.functional.helpers')(after_each)
  3. local command, clear = helpers.command, helpers.clear
  4. local source, expect = helpers.source, helpers.expect
  5. local exc_exec = helpers.exc_exec;
  6. local matches = helpers.matches;
  7. local Screen = require('test.functional.ui.screen')
  8. describe('options', function()
  9. setup(clear)
  10. it('should not throw any exception', function()
  11. command('options')
  12. end)
  13. end)
  14. describe('set', function()
  15. before_each(clear)
  16. it("should keep two comma when 'path' is changed", function()
  17. source([[
  18. set path=foo,,bar
  19. set path-=bar
  20. set path+=bar
  21. $put =&path]])
  22. expect([[
  23. foo,,bar]])
  24. end)
  25. it('winminheight works', function()
  26. local screen = Screen.new(20, 11)
  27. screen:attach()
  28. source([[
  29. set wmh=0 stal=2
  30. below sp | wincmd _
  31. below sp | wincmd _
  32. below sp | wincmd _
  33. below sp
  34. ]])
  35. matches('E36: Not enough room', exc_exec('set wmh=1'))
  36. end)
  37. it('winminheight works with tabline', function()
  38. local screen = Screen.new(20, 11)
  39. screen:attach()
  40. source([[
  41. set wmh=0 stal=2
  42. split
  43. split
  44. split
  45. split
  46. tabnew
  47. ]])
  48. matches('E36: Not enough room', exc_exec('set wmh=1'))
  49. end)
  50. it('scroll works', function()
  51. local screen = Screen.new(42, 16)
  52. screen:attach()
  53. source([[
  54. set scroll=2
  55. set laststatus=2
  56. ]])
  57. command('verbose set scroll?')
  58. screen:expect([[
  59. |
  60. ~ |
  61. ~ |
  62. ~ |
  63. ~ |
  64. ~ |
  65. ~ |
  66. ~ |
  67. ~ |
  68. ~ |
  69. ~ |
  70. ~ |
  71. |
  72. scroll=7 |
  73. Last set from changed window size |
  74. Press ENTER or type command to continue^ |
  75. ]])
  76. end)
  77. it('foldcolumn and signcolumn to empty string is disallowed', function()
  78. matches('E474: Invalid argument: fdc=', exc_exec('set fdc='))
  79. matches('E474: Invalid argument: scl=', exc_exec('set scl='))
  80. end)
  81. end)