~ubuntu-branches/debian/sid/neovim/sid

« back to all changes in this revision

Viewing changes to test/functional/legacy/autocmd_option_spec.lua

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2016-04-18 21:42:19 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20160418214219-1e6d4o1fwqarzk46
Tags: 0.1.3-1
* New upstream release.  (Closes: #820562)
* debian/control:
  + Remove unnecessary luarocks Build-Depends
  + Add libkvm-dev Build-Depends for kfreebsd-*
  + Add python(3)-neovim to Recommends.  (Closes: #812737)
  + Declare compiance with policy 3.9.8, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
local nvim = helpers.meths
3
3
local clear, eq, neq = helpers.clear, helpers.eq, helpers.neq
4
4
local curbuf, buf = helpers.curbuf, helpers.bufmeths
 
5
local curwin = helpers.curwin
 
6
local redir_exec = helpers.redir_exec
5
7
local source, execute = helpers.source, helpers.execute
6
8
 
7
9
local function declare_hook_function()
86
88
 
87
89
local function make_buffer()
88
90
  local old_buf = curbuf()
89
 
  execute('new')
 
91
  execute('botright new')
90
92
  local new_buf = curbuf()
91
93
  execute('wincmd p') -- move previous window
92
94
 
96
98
  return new_buf
97
99
end
98
100
 
 
101
local function get_new_window_number()
 
102
  local old_win = curwin()
 
103
  execute('botright new')
 
104
  local new_win = curwin()
 
105
  local new_winnr = redir_exec('echo winnr()')
 
106
  execute('wincmd p') -- move previous window
 
107
 
 
108
  neq(old_win, new_win)
 
109
  eq(old_win, curwin())
 
110
 
 
111
  return new_winnr:gsub('\n', '')
 
112
end
 
113
 
99
114
describe('au OptionSet', function()
100
115
  describe('with any opton (*)', function()
101
116
 
248
263
      end)
249
264
    end)
250
265
 
 
266
    describe('being set by setwinvar()', function()
 
267
      it('should not trigger because option name does not match with backup', function()
 
268
        set_hook('backup')
 
269
 
 
270
        execute('call setwinvar(1, "&l:bk", 1)')
 
271
        expected_empty()
 
272
      end)
 
273
 
 
274
      it('should trigger, use correct option name backup', function()
 
275
        set_hook('backup')
 
276
 
 
277
        execute('call setwinvar(1, "&backup", 1)')
 
278
        expected_combination({'backup', 0, 1, 'local'})
 
279
      end)
 
280
 
 
281
      it('should not trigger if the current window is different from the targetted window', function()
 
282
        set_hook('cursorcolumn')
 
283
 
 
284
        local new_winnr = get_new_window_number()
 
285
 
 
286
        execute('call setwinvar(' .. new_winnr .. ', "&cursorcolumn", 1)')
 
287
        -- expected_combination({'cursorcolumn', 0, 1, 'local', {winnr = new_winnr}})
 
288
        expected_empty()
 
289
      end)
 
290
    end)
 
291
 
251
292
    describe('being set by neovim api', function()
252
293
      it('should trigger if a boolean option be set globally', function()
253
294
        set_hook('autochdir')