aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/match_functions_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-08-20 22:24:34 +0300
committerZyX <kp-pav@yandex.ru>2017-03-29 10:07:42 +0300
commite18a5783080f7c94f408ec5f53dedffdb69789e1 (patch)
tree17f54dfabb1163f2defce7989b3a182b846334f9 /test/functional/eval/match_functions_spec.lua
parent50a48f2a0ecf7f767df961f7f5060505cf28e331 (diff)
downloadrneovim-e18a5783080f7c94f408ec5f53dedffdb69789e1.tar.gz
rneovim-e18a5783080f7c94f408ec5f53dedffdb69789e1.tar.bz2
rneovim-e18a5783080f7c94f408ec5f53dedffdb69789e1.zip
*: Move some dictionary functions to typval.h and use char*
Also fixes buffer reusage in setmatches() and complete().
Diffstat (limited to 'test/functional/eval/match_functions_spec.lua')
-rw-r--r--test/functional/eval/match_functions_spec.lua39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/functional/eval/match_functions_spec.lua b/test/functional/eval/match_functions_spec.lua
new file mode 100644
index 0000000000..df91e41475
--- /dev/null
+++ b/test/functional/eval/match_functions_spec.lua
@@ -0,0 +1,39 @@
+local helpers = require('test.functional.helpers')(after_each)
+
+local eq = helpers.eq
+local clear = helpers.clear
+local funcs = helpers.funcs
+local command = helpers.command
+
+before_each(clear)
+
+describe('setmatches()', function()
+ it('correctly handles case when both group and pattern entries are numbers',
+ function()
+ command('hi def link 1 PreProc')
+ eq(0, funcs.setmatches({{group=1, pattern=2, id=3, priority=4}}))
+ eq({{
+ group='1',
+ pattern='2',
+ id=3,
+ priority=4,
+ }}, funcs.getmatches())
+ eq(0, funcs.setmatches({{group=1, pattern=2, id=3, priority=4, conceal=5}}))
+ eq({{
+ group='1',
+ pattern='2',
+ id=3,
+ priority=4,
+ conceal='5',
+ }}, funcs.getmatches())
+ eq(0, funcs.setmatches({{group=1, pos1={2}, pos2={6}, id=3, priority=4, conceal=5}}))
+ eq({{
+ group='1',
+ pos1={2},
+ pos2={6},
+ id=3,
+ priority=4,
+ conceal='5',
+ }}, funcs.getmatches())
+ end)
+end)