aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/options_spec.lua
blob: ce46ea013d453603cb5b513fb43ff9c45d0219ea (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
-- See also: test/old/testdir/test_options.vim
local helpers = require('test.functional.helpers')(after_each)
local command, clear = helpers.command, helpers.clear
local source, expect = helpers.source, helpers.expect
local exc_exec = helpers.exc_exec;
local matches = helpers.matches;
local Screen = require('test.functional.ui.screen')

describe('options', function()
  setup(clear)

  it('should not throw any exception', function()
    command('options')
  end)
end)

describe('set', function()
  before_each(clear)

  it("should keep two comma when 'path' is changed", function()
    source([[
      set path=foo,,bar
      set path-=bar
      set path+=bar
      $put =&path]])

    expect([[

      foo,,bar]])
  end)

  it('winminheight works', function()
    local screen = Screen.new(20, 11)
    screen:attach()
    source([[
      set wmh=0 stal=2
      below sp | wincmd _
      below sp | wincmd _
      below sp | wincmd _
      below sp
    ]])
    matches('E36: Not enough room', exc_exec('set wmh=1'))
  end)

  it('winminheight works with tabline', function()
    local screen = Screen.new(20, 11)
    screen:attach()
    source([[
      set wmh=0 stal=2
      split
      split
      split
      split
      tabnew
    ]])
    matches('E36: Not enough room', exc_exec('set wmh=1'))
  end)

  it('scroll works', function()
    local screen = Screen.new(42, 16)
    screen:attach()
    source([[
      set scroll=2
      set laststatus=2
    ]])
    command('verbose set scroll?')
    screen:expect([[
                                                |
      ~                                         |
      ~                                         |
      ~                                         |
      ~                                         |
      ~                                         |
      ~                                         |
      ~                                         |
      ~                                         |
      ~                                         |
      ~                                         |
      ~                                         |
                                                |
        scroll=7                                |
              Last set from changed window size |
      Press ENTER or type command to continue^   |
    ]])
  end)

  it('foldcolumn and signcolumn to empty string is disallowed', function()
    matches('E474: Invalid argument: fdc=', exc_exec('set fdc='))
    matches('E474: Invalid argument: scl=', exc_exec('set scl='))
  end)
end)