forked from aniani/vim
patch 8.0.0645: no error for illegal back reference in NFA engine
Problem: The new regexp engine does not give an error for using a back
reference where it is not allowed. (Dominique Pelle)
Solution: Check the back reference like the old engine. (closes #1774)
This commit is contained in:
@@ -38,11 +38,11 @@ func Test_hlsearch_hangs()
|
||||
return
|
||||
endif
|
||||
|
||||
" This pattern takes forever to match, it should timeout.
|
||||
" This pattern takes a long time to match, it should timeout.
|
||||
help
|
||||
let start = reltime()
|
||||
set hlsearch nolazyredraw redrawtime=101
|
||||
let @/ = '\%#=2\v(a|\1)*'
|
||||
let @/ = '\%#=1a*.*X\@<=b*'
|
||||
redraw
|
||||
let elapsed = reltimefloat(reltime(start))
|
||||
call assert_true(elapsed > 0.1)
|
||||
|
||||
@@ -62,3 +62,13 @@ func Test_eow_with_optional()
|
||||
call assert_equal(expected, actual)
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func Test_backref()
|
||||
new
|
||||
call setline(1, ['one', 'two', 'three', 'four', 'five'])
|
||||
call assert_equal(3, search('\%#=1\(e\)\1'))
|
||||
call assert_equal(3, search('\%#=2\(e\)\1'))
|
||||
call assert_fails('call search("\\%#=1\\(e\\1\\)")', 'E65:')
|
||||
call assert_fails('call search("\\%#=2\\(e\\1\\)")', 'E65:')
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
@@ -223,7 +223,7 @@ func Test_statusline()
|
||||
set statusline=ab%(cd%q%)de
|
||||
call assert_match('^abde\s*$', s:get_statusline())
|
||||
copen
|
||||
call assert_match('^abcd\[Quickfix List\1]de\s*$', s:get_statusline())
|
||||
call assert_match('^abcd\[Quickfix List]de\s*$', s:get_statusline())
|
||||
cclose
|
||||
|
||||
" %#: Set highlight group. The name must follow and then a # again.
|
||||
|
||||
Reference in New Issue
Block a user