From 1ef98b34b3171452e55d656d26b96d803236bf65 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 21:46:30 +0300 Subject: [PATCH] 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. --- .../legacy/009_bufleave_autocommand_spec.lua | 22 +++++++++++++------ 1 file 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