diff options
author | ZyX <kp-pav@yandex.ru> | 2017-04-08 21:46:30 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-04-08 21:46:30 +0300 |
commit | 1ef98b34b3171452e55d656d26b96d803236bf65 (patch) | |
tree | ed728f4dcad94b396b3a5fe5a216bf97f05df4b8 | |
parent | cd0a436622d0eeafcbc79e0a6e53088b881ab5b1 (diff) | |
download | rneovim-1ef98b34b3171452e55d656d26b96d803236bf65.tar.gz rneovim-1ef98b34b3171452e55d656d26b96d803236bf65.tar.bz2 rneovim-1ef98b34b3171452e55d656d26b96d803236bf65.zip |
functests: Refactor 009_bufleave_autocommand_spec
It was not testing anything actually: the `e yy` command simply failed because
of unsaved changes, BufLeave never run thus.
-rw-r--r-- | test/functional/legacy/009_bufleave_autocommand_spec.lua | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/test/functional/legacy/009_bufleave_autocommand_spec.lua b/test/functional/legacy/009_bufleave_autocommand_spec.lua index 7481c639cf..e2b3dca685 100644 --- a/test/functional/legacy/009_bufleave_autocommand_spec.lua +++ b/test/functional/legacy/009_bufleave_autocommand_spec.lua @@ -1,19 +1,27 @@ -- Test for Bufleave autocommand that deletes the buffer we are about to edit. local helpers = require('test.functional.helpers')(after_each) -local clear, insert = helpers.clear, helpers.insert -local execute, expect = helpers.execute, helpers.expect + +local eq = helpers.eq +local clear = helpers.clear +local meths = helpers.meths +local expect = helpers.expect +local command = helpers.command +local exc_exec = helpers.exc_exec +local curbufmeths = helpers.curbufmeths describe('BufLeave autocommand', function() setup(clear) it('is working', function() - insert([[ - start of test file xx - end of test file xx]]) + meths.set_option('hidden', true) + curbufmeths.set_lines(0, 1, false, { + 'start of test file xx', + 'end of test file xx'}) - execute('au BufLeave * bwipe yy') - execute('e yy') + command('autocmd BufLeave * bwipeout yy') + eq('Vim(edit):E143: Autocommands unexpectedly deleted new buffer yy', + exc_exec('edit yy')) expect([[ start of test file xx |