diff options
author | ZyX <kp-pav@yandex.ru> | 2017-07-01 15:34:25 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-07-01 15:34:25 +0300 |
commit | 7ab152aaa58f493e54d03a15960b8a288196e588 (patch) | |
tree | 98bdee4ca0c37d1b71b70fe0db4fedb3c4ef1f64 /test/functional/ui/cmdline_highlight_spec.lua | |
parent | ea75966e4232dc4a3693cbc4a572f2116c49b138 (diff) | |
download | rneovim-7ab152aaa58f493e54d03a15960b8a288196e588.tar.gz rneovim-7ab152aaa58f493e54d03a15960b8a288196e588.tar.bz2 rneovim-7ab152aaa58f493e54d03a15960b8a288196e588.zip |
ex_getln: Save and restore try state
Problem: when processing cycle such as
:for pat in [' \ze*', ' \zs*']
: try
: let l = matchlist('x x', pat)
: $put ='E888 NOT detected for ' . pat
: catch
: $put ='E888 detected for ' . pat
: endtry
:endfor
`:let l = …` throwing an error causes this error to be caught after
color_cmdline attempts to get callback for highlighting next line (the one with
`$put = 'E888 NOT…`). Saving/restoring state prevents this from happening.
Diffstat (limited to 'test/functional/ui/cmdline_highlight_spec.lua')
-rw-r--r-- | test/functional/ui/cmdline_highlight_spec.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua index 671490e668..62c0694c8c 100644 --- a/test/functional/ui/cmdline_highlight_spec.lua +++ b/test/functional/ui/cmdline_highlight_spec.lua @@ -7,6 +7,8 @@ local clear = helpers.clear local meths = helpers.meths local funcs = helpers.funcs local source = helpers.source +local dedent = helpers.dedent +local curbufmeths = helpers.curbufmeths local screen @@ -421,6 +423,8 @@ describe('Command-line coloring', function() ]]) end) -- TODO Check for all other errors + -- TODO Check for colored input() called in a cycle which previously errorred + -- out end) describe('Ex commands coloring support', function() it('still executes command-line even if errored out', function() @@ -430,7 +434,27 @@ describe('Ex commands coloring support', function() local msg = 'E5405: Chunk 0 start 10 splits multibyte character' eq('\n'..msg, funcs.execute('messages')) end) + it('does not error out when called from a errorred out cycle', function() + -- Apparently when there is a cycle in which one of the commands errors out + -- this error may be caught by color_cmdline before it is presented to the + -- user. + feed(dedent([[ + :set regexpengine=2 + :for pat in [' \ze*', ' \zs*'] + : try + : let l = matchlist('x x', pat) + : $put ='E888 NOT detected for ' . pat + : catch + : $put ='E888 detected for ' . pat + : endtry + :endfor + ]])) + eq({'', 'E888 detected for \\ze*', 'E888 detected for \\zs*'}, + curbufmeths.get_lines(0, -1, false)) + eq('', funcs.execute('messages')) + end) end) -- TODO Specifically test for coloring in cmdline and expr modes +-- TODO Check for errors from tv_dict_get_callback() -- TODO Check using highlighted input() from inside highlighted input() |