From 65fb622000af8e3dbb65480e1581758ecf4ba3e2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 00:12:26 +0300 Subject: functests: Replace execute with either command or feed_command Hope this will make people using feed_command less likely: this hides bugs. Already found at least two: 1. msgpackparse() will show internal error: hash_add() in case of duplicate keys, though it will still work correctly. Currently silenced. 2. ttimeoutlen was spelled incorrectly, resulting in option not being set when expected. Test was still functioning somehow though. Currently fixed. --- test/functional/legacy/mapping_spec.lua | 62 ++++++++++++++++----------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'test/functional/legacy/mapping_spec.lua') diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua index 1712219d04..56a5652184 100644 --- a/test/functional/legacy/mapping_spec.lua +++ b/test/functional/legacy/mapping_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local execute, expect, wait = helpers.execute, helpers.expect, helpers.wait +local feed_command, expect, wait = helpers.feed_command, helpers.expect, helpers.wait describe('mapping', function() before_each(clear) @@ -13,7 +13,7 @@ describe('mapping', function() ]]) -- Abbreviations with р (0x80) should work. - execute('inoreab чкпр vim') + feed_command('inoreab чкпр vim') feed('GAчкпр ') expect([[ @@ -23,61 +23,61 @@ describe('mapping', function() it('Ctrl-c works in Insert mode', function() -- Mapping of ctrl-c in insert mode - execute('set cpo-=< cpo-=k') - execute('inoremap ') - execute('cnoremap dummy') - execute('cunmap ') + feed_command('set cpo-=< cpo-=k') + feed_command('inoremap ') + feed_command('cnoremap dummy') + feed_command('cunmap ') feed('GA') feed('TEST2: CTRL-C |') wait() feed('A|') wait() - execute('unmap ') - execute('unmap! ') + feed_command('unmap ') + feed_command('unmap! ') expect([[ - + TEST2: CTRL-C |A| ]]) end) it('Ctrl-c works in Visual mode', function() - execute([[vnoremap :$put ='vmap works']]) + feed_command([[vnoremap :$put ='vmap works']]) feed('GV') -- XXX: For some reason the mapping is only triggered -- when is in a separate feed command. wait() feed('') - execute('vunmap ') + feed_command('vunmap ') expect([[ - + vmap works]]) end) it('langmap', function() -- langmap should not get remapped in insert mode. - execute('inoremap { FAIL_ilangmap') - execute('set langmap=+{ langnoremap') + feed_command('inoremap { FAIL_ilangmap') + feed_command('set langmap=+{ langnoremap') feed('o+') -- Insert mode expr mapping with langmap. - execute('inoremap { "FAIL_iexplangmap"') + feed_command('inoremap { "FAIL_iexplangmap"') feed('o+') -- langmap should not get remapped in cmdline mode. - execute('cnoremap { FAIL_clangmap') + feed_command('cnoremap { FAIL_clangmap') feed('o+') - execute('cunmap {') + feed_command('cunmap {') -- cmdline mode expr mapping with langmap. - execute('cnoremap { "FAIL_cexplangmap"') + feed_command('cnoremap { "FAIL_cexplangmap"') feed('o+') - execute('cunmap {') + feed_command('cunmap {') -- Assert buffer contents. expect([[ - + + + + @@ -91,10 +91,10 @@ describe('mapping', function() ]]) -- Vim's issue #212 (feedkeys insert mapping at current position) - execute('nnoremap . :call feedkeys(".", "in")') + feed_command('nnoremap . :call feedkeys(".", "in")') feed('/^a b') feed('0qqdw.ifooqj0@q') - execute('unmap .') + feed_command('unmap .') expect([[ fooc d fooc d @@ -103,23 +103,23 @@ describe('mapping', function() it('i_CTRL-G_U', function() -- U works only within a single line - execute('imapclear') - execute('imap ( ()U') + feed_command('imapclear') + feed_command('imap ( ()U') feed('G2okiTest1: text with a (here some more textk.') -- test undo feed('G2okiTest2: text wit a (here some more text [und undo]uk.u') - execute('imapclear') - execute('set whichwrap=<,>,[,]') + feed_command('imapclear') + feed_command('set whichwrap=<,>,[,]') feed('G3o2k') - execute([[:exe ":norm! iTest3: text with a (parenthesis here\U\new line here\\\."]]) + feed_command([[:exe ":norm! iTest3: text with a (parenthesis here\U\new line here\\\."]]) expect([[ - - + + Test1: text with a (here some more text) Test1: text with a (here some more text) - - + + Test2: text wit a (here some more text [und undo]) new line here Test3: text with a (parenthesis here -- cgit