aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2016-03-02 02:28:08 +0100
committerMarco Hinz <mh.codebro@gmail.com>2016-03-02 12:37:50 +0100
commita528d56ba0169cc902f6fe952ca7625cc29cb940 (patch)
treeb40ffb79631d4d9e01c2df2c1b0fe14c4a19c93e
parentd9e631f1b5f65a94d0c6aea3cace46cc1d02398a (diff)
downloadrneovim-a528d56ba0169cc902f6fe952ca7625cc29cb940.tar.gz
rneovim-a528d56ba0169cc902f6fe952ca7625cc29cb940.tar.bz2
rneovim-a528d56ba0169cc902f6fe952ca7625cc29cb940.zip
Tests: add autocmd_spec.lua
-rw-r--r--test/functional/autocmd/autocmd_spec.lua31
-rw-r--r--test/functional/legacy/062_tab_pages_spec.lua4
2 files changed, 31 insertions, 4 deletions
diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua
new file mode 100644
index 0000000000..3c813abc2e
--- /dev/null
+++ b/test/functional/autocmd/autocmd_spec.lua
@@ -0,0 +1,31 @@
+local helpers = require('test.functional.helpers')
+
+local clear = helpers.clear
+local command = helpers.command
+local eval = helpers.eval
+
+describe('autocmds:', function()
+ before_each(clear)
+
+ it(':tabnew triggers events in the correct order', function()
+ local expected = {
+ 'WinLeave',
+ 'TabLeave',
+ 'TabNew',
+ 'WinEnter',
+ 'TabEnter',
+ 'BufLeave',
+ 'BufEnter'
+ }
+ command('let g:foo = []')
+ command('autocmd BufEnter * :call add(g:foo, "BufEnter")')
+ command('autocmd BufLeave * :call add(g:foo, "BufLeave")')
+ command('autocmd TabEnter * :call add(g:foo, "TabEnter")')
+ command('autocmd TabLeave * :call add(g:foo, "TabLeave")')
+ command('autocmd TabNew * :call add(g:foo, "TabNew")')
+ command('autocmd WinEnter * :call add(g:foo, "WinEnter")')
+ command('autocmd WinLeave * :call add(g:foo, "WinLeave")')
+ command('tabnew')
+ assert.same(expected, eval('g:foo'))
+ end)
+end)
diff --git a/test/functional/legacy/062_tab_pages_spec.lua b/test/functional/legacy/062_tab_pages_spec.lua
index c3cdcac471..f1c8b8d58b 100644
--- a/test/functional/legacy/062_tab_pages_spec.lua
+++ b/test/functional/legacy/062_tab_pages_spec.lua
@@ -139,7 +139,6 @@ describe('tab pages', function()
autocmd TabLeave * :call add(g:r, 'TabLeave')
autocmd WinLeave * :call add(g:r, 'WinLeave')
autocmd BufLeave * :call add(g:r, 'BufLeave')
- autocmd TabNew * :call add(g:r, 'TabNew')
let t:a='a'
C tab split
let t:a='b'
@@ -186,13 +185,11 @@ describe('tab pages', function()
=== tab split ===
WinLeave
TabLeave
- TabNew
WinEnter
TabEnter
=== tabnew ===
WinLeave
TabLeave
- TabNew
WinEnter
TabEnter
BufLeave
@@ -225,7 +222,6 @@ describe('tab pages', function()
=== tabnew ===
WinLeave
TabLeave
- TabNew
WinEnter
TabEnter
BufLeave