diff options
| -rw-r--r-- | test/functional/legacy/063_match_and_matchadd_spec.lua | 15 | 
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 | 
