aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-17 10:50:19 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-07-17 10:50:19 +0800
commit8f890f74b692406485f1bbdf22ec608421f58886 (patch)
tree2c47532742915de47e94c873df1b9d1ec68f1337
parent4025c2aa5f788ba2772d8f0dd3f7add499333878 (diff)
downloadrneovim-8f890f74b692406485f1bbdf22ec608421f58886.tar.gz
rneovim-8f890f74b692406485f1bbdf22ec608421f58886.tar.bz2
rneovim-8f890f74b692406485f1bbdf22ec608421f58886.zip
test(old): reorder test_regexp_latin.vim to match upstream
-rw-r--r--test/old/testdir/test_regexp_latin.vim102
-rw-r--r--test/old/testdir/test_regexp_utf8.vim32
2 files changed, 66 insertions, 68 deletions
diff --git a/test/old/testdir/test_regexp_latin.vim b/test/old/testdir/test_regexp_latin.vim
index 2cfa81e078..c8eb7ef000 100644
--- a/test/old/testdir/test_regexp_latin.vim
+++ b/test/old/testdir/test_regexp_latin.vim
@@ -28,61 +28,47 @@ func s:equivalence_test()
endfunc
func Test_equivalence_re1()
- throw 'skipped: Nvim does not support enc=latin1'
set re=1
call s:equivalence_test()
endfunc
func Test_equivalence_re2()
- throw 'skipped: Nvim does not support enc=latin1'
set re=2
call s:equivalence_test()
endfunc
-func Test_range_with_newline()
+func Test_recursive_substitute()
new
- call setline(1, "a")
- call assert_equal(0, search("[ -*\\n- ]"))
- call assert_equal(0, search("[ -*\\t-\\n]"))
+ s/^/\=execute("s#^##gn")
+ " check we are now not in the sandbox
+ call setwinvar(1, 'myvar', 1)
bwipe!
endfunc
-func Test_pattern_compile_speed()
- CheckOption spellcapcheck
- CheckFunction reltimefloat
-
- let start = reltime()
- " this used to be very slow, not it should be about a second
- set spc=\\v(((((Nxxxxxxx&&xxxx){179})+)+)+){179}
- call assert_inrange(0.01, 10.0, reltimefloat(reltime(start)))
- set spc=
-endfunc
-
-func Test_get_equi_class()
+func Test_nested_backrefs()
+ " Check example in change.txt.
new
- " Incomplete equivalence class caused invalid memory access
- s/^/[[=
- call assert_equal(1, search(getline(1)))
- s/.*/[[.
- call assert_equal(1, search(getline(1)))
-endfunc
+ for re in range(0, 2)
+ exe 'set re=' . re
+ call setline(1, 'aa ab x')
+ 1s/\(\(a[a-d] \)*\)\(x\)/-\1- -\2- -\3-/
+ call assert_equal('-aa ab - -ab - -x-', getline(1))
-func Test_rex_init()
- set noincsearch
- set re=1
- new
- setlocal iskeyword=a-z
- call setline(1, ['abc', 'ABC'])
- call assert_equal(1, search('[[:keyword:]]'))
- new
- setlocal iskeyword=A-Z
- call setline(1, ['abc', 'ABC'])
- call assert_equal(2, search('[[:keyword:]]'))
- bwipe!
+ call assert_equal('-aa ab - -ab - -x-', substitute('aa ab x', '\(\(a[a-d] \)*\)\(x\)', '-\1- -\2- -\3-', ''))
+ endfor
bwipe!
set re=0
endfunc
+func Test_eow_with_optional()
+ let expected = ['abc def', 'abc', 'def', '', '', '', '', '', '', '']
+ for re in range(0, 2)
+ exe 'set re=' . re
+ let actual = matchlist('abc def', '\(abc\>\)\?\s*\(def\)')
+ call assert_equal(expected, actual)
+ endfor
+endfunc
+
func Test_backref()
new
call setline(1, ['one', 'two', 'three', 'four', 'five'])
@@ -144,6 +130,50 @@ func Test_out_of_memory()
call assert_fails('call search("\\v((n||<)+);")', 'E363:')
endfunc
+func Test_get_equi_class()
+ new
+ " Incomplete equivalence class caused invalid memory access
+ s/^/[[=
+ call assert_equal(1, search(getline(1)))
+ s/.*/[[.
+ call assert_equal(1, search(getline(1)))
+endfunc
+
+func Test_rex_init()
+ set noincsearch
+ set re=1
+ new
+ setlocal iskeyword=a-z
+ call setline(1, ['abc', 'ABC'])
+ call assert_equal(1, search('[[:keyword:]]'))
+ new
+ setlocal iskeyword=A-Z
+ call setline(1, ['abc', 'ABC'])
+ call assert_equal(2, search('[[:keyword:]]'))
+ bwipe!
+ bwipe!
+ set re=0
+endfunc
+
+func Test_range_with_newline()
+ new
+ call setline(1, "a")
+ call assert_equal(0, search("[ -*\\n- ]"))
+ call assert_equal(0, search("[ -*\\t-\\n]"))
+ bwipe!
+endfunc
+
+func Test_pattern_compile_speed()
+ CheckOption spellcapcheck
+ CheckFunction reltimefloat
+
+ let start = reltime()
+ " this used to be very slow, not it should be about a second
+ set spc=\\v(((((Nxxxxxxx&&xxxx){179})+)+)+){179}
+ call assert_inrange(0.01, 10.0, reltimefloat(reltime(start)))
+ set spc=
+endfunc
+
" Tests for regexp patterns without multi-byte support.
func Test_regexp_single_line_pat()
" tl is a List of Lists with:
diff --git a/test/old/testdir/test_regexp_utf8.vim b/test/old/testdir/test_regexp_utf8.vim
index 728a88fa0f..f9ad1fc7ca 100644
--- a/test/old/testdir/test_regexp_utf8.vim
+++ b/test/old/testdir/test_regexp_utf8.vim
@@ -188,38 +188,6 @@ func Test_classes_re2()
set re=0
endfunc
-func Test_recursive_substitute()
- new
- s/^/\=execute("s#^##gn")
- " check we are now not in the sandbox
- call setwinvar(1, 'myvar', 1)
- bwipe!
-endfunc
-
-func Test_nested_backrefs()
- " Check example in change.txt.
- new
- for re in range(0, 2)
- exe 'set re=' . re
- call setline(1, 'aa ab x')
- 1s/\(\(a[a-d] \)*\)\(x\)/-\1- -\2- -\3-/
- call assert_equal('-aa ab - -ab - -x-', getline(1))
-
- call assert_equal('-aa ab - -ab - -x-', substitute('aa ab x', '\(\(a[a-d] \)*\)\(x\)', '-\1- -\2- -\3-', ''))
- endfor
- bwipe!
- set re=0
-endfunc
-
-func Test_eow_with_optional()
- let expected = ['abc def', 'abc', 'def', '', '', '', '', '', '', '']
- for re in range(0, 2)
- exe 'set re=' . re
- let actual = matchlist('abc def', '\(abc\>\)\?\s*\(def\)')
- call assert_equal(expected, actual)
- endfor
-endfunc
-
func Test_reversed_range()
for re in range(0, 2)
exe 'set re=' . re