aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-04-09 01:49:21 +0300
committerZyX <kp-pav@yandex.ru>2017-04-09 03:24:10 +0300
commitcb57644cb40123af17f03a4381b838ebbe137dd8 (patch)
tree54464dfa9c4e49ed2120de4e2ad676743441b357
parentb3b31e10657462b8ebbee91db8315c9ffa2b85de (diff)
downloadrneovim-cb57644cb40123af17f03a4381b838ebbe137dd8.tar.gz
rneovim-cb57644cb40123af17f03a4381b838ebbe137dd8.tar.bz2
rneovim-cb57644cb40123af17f03a4381b838ebbe137dd8.zip
functests: Fix legacy/063_match_and_matchadd_spec
-rw-r--r--test/functional/legacy/063_match_and_matchadd_spec.lua15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/functional/legacy/063_match_and_matchadd_spec.lua b/test/functional/legacy/063_match_and_matchadd_spec.lua
index 34163d5a55..78a712ef08 100644
--- a/test/functional/legacy/063_match_and_matchadd_spec.lua
+++ b/test/functional/legacy/063_match_and_matchadd_spec.lua
@@ -5,6 +5,7 @@ local Screen = require('test.functional.ui.screen')
local feed, insert = helpers.feed, helpers.insert
local eval, clear, command = helpers.eval, helpers.clear, helpers.command
local eq, neq = helpers.eq, helpers.neq
+local redir_exec = helpers.redir_exec
describe('063: Test for ":match", "matchadd()" and related functions', function()
setup(clear)
@@ -61,7 +62,8 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
-- matchdelete throws error and returns -1 on failure
neq(true, pcall(function() eval('matchdelete(42)') end))
- command("let r2 = matchdelete(42)")
+ eq('\nE803: ID not found: 42',
+ redir_exec("let r2 = matchdelete(42)"))
eq(-1, eval('r2'))
-- Check that "clearmatches()" clears all matches defined by ":match" and
@@ -98,8 +100,8 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
-- Check that "setmatches()" will not add two matches with the same ID. The
-- expected behaviour (for now) is to add the first match but not the
-- second and to return -1.
- command("let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}])")
- feed("<cr>")
+ eq('\nE801: ID already taken: 1',
+ redir_exec("let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}])"))
eq(-1, eval("r1"))
eq({{group = 'MyGroup1', pattern = 'TODO', priority = 10, id = 1}}, eval('getmatches()'))
@@ -109,12 +111,11 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
eq(0,eval("setmatches([])"))
eq(0,eval("setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}])"))
command("call clearmatches()")
- command("let rf1 = setmatches(0)")
+ eq('\nE714: List required', redir_exec("let rf1 = setmatches(0)"))
eq(-1, eval('rf1'))
- command("let rf2 = setmatches([0])")
+ eq('\nE474: Invalid argument', redir_exec("let rf2 = setmatches([0])"))
eq(-1, eval('rf2'))
- command("let rf3 = setmatches([{'wrong key': 'wrong value'}])")
- feed("<cr>")
+ eq('\nE474: Invalid argument', redir_exec("let rf3 = setmatches([{'wrong key': 'wrong value'}])"))
eq(-1, eval('rf3'))
-- Check that "matchaddpos()" positions matches correctly