aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/089_number_relnumber_findfile_spec.lua
blob: f72ebf3f728ada914766b69f6bebf73db2cae847 (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
-- - Some tests for setting 'number' and 'relativenumber'
--   This is not all that useful now that the options are no longer reset when
--   setting the other.

local helpers = require('test.functional.helpers')
local feed = helpers.feed
local clear, expect, source = helpers.clear, helpers.expect, helpers.source

describe("setting 'number' and 'relativenumber'", function()
  setup(clear)

  it('is working', function()
    source([[
        set hidden nu rnu
        redir @a | set nu? | set rnu? | redir END
        e! xx
        redir @b | set nu? | set rnu? | redir END
        e! #
        $put ='results:'
        $put a
        $put b

        set nonu nornu
        setglobal nu
        setlocal rnu
        redir @c | setglobal nu? | redir END
        set nonu nornu
        setglobal rnu
        setlocal nu
        redir @d | setglobal rnu? | redir END
        $put =':setlocal must NOT reset the other global value'
        $put c
        $put d

        set nonu nornu
        setglobal nu
        setglobal rnu
        redir @e | setglobal nu? | redir END
        set nonu nornu
        setglobal rnu
        setglobal nu
        redir @f | setglobal rnu? | redir END
        $put =':setglobal MUST reset the other global value'
        $put e
        $put f

        set nonu nornu
        set nu
        set rnu
        redir @g | setglobal nu? | redir END
        set nonu nornu
        set rnu
        set nu
        redir @h | setglobal rnu? | redir END
        $put =':set MUST reset the other global value'
        $put g
        $put h
    ]])

    -- Remove empty line
    feed('ggdd')

    -- Assert buffer contents.
    expect([[
      results:
      
        number
        relativenumber
      
        number
        relativenumber
      :setlocal must NOT reset the other global value
      
        number
      
        relativenumber
      :setglobal MUST reset the other global value
      
        number
      
        relativenumber
      :set MUST reset the other global value
      
        number
      
        relativenumber]])
  end)
end)

-- - Some tests for findfile() function
describe('findfile', function()
  setup(clear)

  it('is working', function()
    -- Assume test is being run from project root
    source([[
        $put ='Testing findfile'
        $put =''
        set ssl
        $put =findfile('vim.c','src/nvim/ap*')
        cd src/nvim
        $put =findfile('vim.c','ap*')
        $put =findfile('vim.c','api')
    ]])

    -- Remove empty line
    feed('ggdd')

    expect([[
      Testing findfile
      
      src/nvim/api/vim.c
      api/vim.c
      api/vim.c]])
  end)
end)