diff src/testdir/test_expr.vim @ 10245:d76ccdacb41e v8.0.0020

commit https://github.com/vim/vim/commit/6100d02aab7c8294b581cb299250eea164b50e9d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 2 16:51:57 2016 +0200 patch 8.0.0020 Problem: The regexp engines are not reentrant. Solution: Add regexec_T and save/restore the state when needed.
author Christian Brabandt <cb@256bit.org>
date Sun, 02 Oct 2016 17:00:05 +0200
parents 9415453b7bbd
children 053d4ad16f37
line wrap: on
line diff
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -405,9 +405,10 @@ func Test_substitute_expr()
 	\ {-> submatch(2) . submatch(3) . submatch(1)}, ''))
 
   func Recurse()
-    return substitute('yyy', 'y*', {-> g:val}, '')
+    return substitute('yyy', 'y\(.\)y', {-> submatch(1)}, '')
   endfunc
-  call assert_equal('--', substitute('xxx', 'x*', {-> '-' . Recurse() . '-'}, ''))
+  " recursive call works
+  call assert_equal('-y-x-', substitute('xxx', 'x\(.\)x', {-> '-' . Recurse() . '-' . submatch(1) . '-'}, ''))
 endfunc
 
 func Test_invalid_submatch()