aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Malcomson <hardenedapple@gmail.com>2017-04-19 12:01:41 +0100
committerMatthew Malcomson <hardenedapple@gmail.com>2018-03-14 10:39:14 +0000
commit1aefbff641ec6da77aa1954cbc6d1f10e0f69346 (patch)
tree52a83e8c33902cf21aaa056f188dd02d8415ef5d
parent5ce8158a5d462043306ee67a3261794f169bdb17 (diff)
downloadrneovim-1aefbff641ec6da77aa1954cbc6d1f10e0f69346.tar.gz
rneovim-1aefbff641ec6da77aa1954cbc6d1f10e0f69346.tar.bz2
rneovim-1aefbff641ec6da77aa1954cbc6d1f10e0f69346.zip
Add some basic tests for macros
-rw-r--r--test/functional/normal/macro_spec.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/normal/macro_spec.lua b/test/functional/normal/macro_spec.lua
new file mode 100644
index 0000000000..102d8fc723
--- /dev/null
+++ b/test/functional/normal/macro_spec.lua
@@ -0,0 +1,30 @@
+local helpers = require('test.functional.helpers')(after_each)
+
+local eq = helpers.eq
+local eval = helpers.eval
+local feed = helpers.feed
+local clear = helpers.clear
+local expect = helpers.expect
+local command = helpers.command
+
+describe('macros', function()
+ before_each(clear)
+ it('can be recorded and replayed', function()
+ feed('qiahello<esc>q')
+ expect('hello')
+ eq(eval('@i'), 'ahello')
+ feed('@i')
+ expect('hellohello')
+ eq(eval('@i'), 'ahello')
+ end)
+ it('applies maps', function()
+ command('imap x l')
+ command('nmap l a')
+ feed('qilxxx<esc>q')
+ expect('lll')
+ eq(eval('@i'), 'lxxx')
+ feed('@i')
+ expect('llllll')
+ eq(eval('@i'), 'lxxx')
+ end)
+end)