diff options
author | Felipe Morales <hel.sheep@gmail.com> | 2014-12-22 02:05:22 -0300 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-02-16 23:24:30 -0500 |
commit | 817be96be535a8aecc24a72f51fe2d6743ed4a24 (patch) | |
tree | 89d896fc8bb6e6f47db50d6f5a2361a2c35b5ab8 /test | |
parent | 0429857689ba98356bc80d01ebd540fe861e8db2 (diff) | |
download | rneovim-817be96be535a8aecc24a72f51fe2d6743ed4a24.tar.gz rneovim-817be96be535a8aecc24a72f51fe2d6743ed4a24.tar.bz2 rneovim-817be96be535a8aecc24a72f51fe2d6743ed4a24.zip |
Add TabNew event
TabNew triggers when entering a new tab page, but not when entering an
already created one.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/autocmd/tabnew_spec.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/autocmd/tabnew_spec.lua b/test/functional/autocmd/tabnew_spec.lua new file mode 100644 index 0000000000..970ca19726 --- /dev/null +++ b/test/functional/autocmd/tabnew_spec.lua @@ -0,0 +1,24 @@ +local helpers = require('test.functional.helpers') +local clear, nvim, buffer, curbuf, curwin, eq, neq, ok = + helpers.clear, helpers.nvim, helpers.buffer, helpers.curbuf, helpers.curwin, + helpers.eq, helpers.neq, helpers.ok + +describe('TabNew', function() + describe('au TabNew', function() + clear() + describe('with * as <afile>', function() + it('matches when opening any new tab', function() + nvim('command', 'au! TabNew * echom "tabnew:".tabpagenr().":".bufnr("")') + eq("\ntabnew:2:1", nvim('command_output', 'tabnew')) + eq("\ntabnew:3:2\n\"test.x\" [New File]", nvim('command_output', 'tabnew test.x')) + end) + end) + describe('with FILE as <afile>', function() + it('matches when opening a new tab for FILE', function() + tmp_path = nvim('eval', 'tempname()') + nvim('command', 'au! TabNew '..tmp_path..' echom "tabnew:match"') + eq("\ntabnew:4:3\ntabnew:match\n\""..tmp_path.."\" [New File]", nvim('command_output', 'tabnew '..tmp_path)) + end) + end) + end) +end) |