diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-03-28 11:15:19 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-03-29 08:23:02 -0400 |
| commit | 8b60368c1b9e23f0695557da170d416d71f7e6a3 (patch) | |
| tree | 567daec11deb4e34e33860de8bba787a9819bfff /src/nvim/testdir | |
| parent | aa6adacd77e59b2cf2ca7bdeae9a24c062b2a9c0 (diff) | |
| download | rneovim-8b60368c1b9e23f0695557da170d416d71f7e6a3.tar.gz rneovim-8b60368c1b9e23f0695557da170d416d71f7e6a3.tar.bz2 rneovim-8b60368c1b9e23f0695557da170d416d71f7e6a3.zip | |
vim-patch:8.1.0958: compiling weird regexp pattern is very slow
Problem: Compiling weird regexp pattern is very slow.
Solution: When reallocating post list increase size by 50%. (Kuang-che Wu,
closes vim/vim#4012) Make assert_inrange() accept float values.
https://github.com/vim/vim/commit/38f08e76acf7d21bb34cf8f79f0f82eb63cdc987
Omit changes to typval_compare()
because patch v8.0.1505 was not ported.
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_assert.vim | 31 | ||||
| -rw-r--r-- | src/nvim/testdir/test_regexp_latin.vim | 11 |
2 files changed, 42 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_assert.vim b/src/nvim/testdir/test_assert.vim index b4f7478807..1d114221dc 100644 --- a/src/nvim/testdir/test_assert.vim +++ b/src/nvim/testdir/test_assert.vim @@ -52,6 +52,37 @@ func Test_assert_fails_in_try_block() endtry endfunc +func Test_assert_inrange() + call assert_equal(0, assert_inrange(7, 7, 7)) + call assert_equal(0, assert_inrange(5, 7, 5)) + call assert_equal(0, assert_inrange(5, 7, 6)) + call assert_equal(0, assert_inrange(5, 7, 7)) + call assert_equal(1, assert_inrange(5, 7, 4)) + call assert_match("Expected range 5 - 7, but got 4", v:errors[0]) + call remove(v:errors, 0) + call assert_equal(1, assert_inrange(5, 7, 8)) + call assert_match("Expected range 5 - 7, but got 8", v:errors[0]) + call remove(v:errors, 0) + + call assert_fails('call assert_inrange(1, 1)', 'E119:') + + if has('float') + call assert_equal(0, assert_inrange(7.0, 7, 7)) + call assert_equal(0, assert_inrange(7, 7.0, 7)) + call assert_equal(0, assert_inrange(7, 7, 7.0)) + call assert_equal(0, assert_inrange(5, 7, 5.0)) + call assert_equal(0, assert_inrange(5, 7, 6.0)) + call assert_equal(0, assert_inrange(5, 7, 7.0)) + + call assert_equal(1, assert_inrange(5, 7, 4.0)) + call assert_match("Expected range 5.0 - 7.0, but got 4.0", v:errors[0]) + call remove(v:errors, 0) + call assert_equal(1, assert_inrange(5, 7, 8.0)) + call assert_match("Expected range 5.0 - 7.0, but got 8.0", v:errors[0]) + call remove(v:errors, 0) + endif +endfunc + " Must be last. func Test_zz_quit_detected() " Verify that if a test function ends Vim the test script detects this. diff --git a/src/nvim/testdir/test_regexp_latin.vim b/src/nvim/testdir/test_regexp_latin.vim index 1bb2ee53de..a1da5db778 100644 --- a/src/nvim/testdir/test_regexp_latin.vim +++ b/src/nvim/testdir/test_regexp_latin.vim @@ -39,6 +39,17 @@ func Test_range_with_newline() bwipe! endfunc +func Test_pattern_compile_speed() + if !exists('+spellcapcheck') || !has('reltime') + return + endif + 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() new " Incomplete equivalence class caused invalid memory access |