diff options
Diffstat (limited to 'src/testdir/test86.in')
-rw-r--r-- | src/testdir/test86.in | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/src/testdir/test86.in b/src/testdir/test86.in index c49eb3bad..fac315e2d 100644 --- a/src/testdir/test86.in +++ b/src/testdir/test86.in @@ -380,20 +380,24 @@ def e(s, g=globals(), l=locals()): try: exec(s, g, l) except: - vim.command('throw ' + repr(sys.exc_type.__name__)) + vim.command('return ' + repr(sys.exc_type.__name__)) def ev(s, g=globals(), l=locals()): try: return eval(s, g, l) except: - vim.command('throw ' + repr(sys.exc_type.__name__)) + vim.command('let exc=' + repr(sys.exc_type.__name__)) return 0 EOF :function E(s) : python e(vim.eval('a:s')) :endfunction :function Ev(s) -: return pyeval('ev(vim.eval("a:s"))') +: let r=pyeval('ev(vim.eval("a:s"))') +: if exists('exc') +: throw exc +: endif +: return r :endfunction :py gopts1=vim.options :py wopts1=vim.windows[2].options @@ -437,27 +441,24 @@ EOF : catch : put =' p/'.v.'! '.v:exception : endtry -: try -: call E(v.'["'.oname.'"]=invval') -: catch -: put =' inv: '.string(invval).'! '.v:exception -: endtry +: let r=E(v.'['''.oname.''']=invval') +: if r isnot 0 +: put =' inv: '.string(invval).'! '.r +: endif : for vv in (v is# 'gopts1' ? [v] : [v, v[:-2].'2', v[:-2].'3']) : let val=substitute(vv, '^.opts', 'oval', '') -: try -: call E(vv.'["'.oname.'"]='.val) -: catch -: put =' '.vv.'! '.v:exception -: endtry +: let r=E(vv.'['''.oname.''']='.val) +: if r isnot 0 +: put =' '.vv.'! '.r +: endif : endfor : endfor : call RecVars(oname) : for v in ['wopts3', 'bopts3'] -: try -: call E('del '.v.'["'.oname.'"]') -: catch -: put =' del '.v.'! '.v:exception -: endtry +: let r=E('del '.v.'["'.oname.'"]') +: if r isnot 0 +: put =' del '.v.'! '.r +: endif : endfor : call RecVars(oname) :endfor @@ -651,6 +652,25 @@ for expr, attr in ( ): cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr))) EOF +:" +:" Test exceptions +:fun Exe(e) +: execute a:e +:endfun +py << EOF +def ee(expr, g=globals(), l=locals()): + try: + exec(expr, g, l) + except: + cb.append(repr(sys.exc_info()[:2])) +Exe = vim.bindeval('function("Exe")') +ee('vim.command("throw \'abc\'")') +ee('Exe("throw \'def\'")') +ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")') +ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")') +ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")') +ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")') +EOF :endfun :" :call Test() |