diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-05-07 17:55:55 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-05-07 17:55:55 +0200 |
commit | f18332fb9e2e4208a97d800f096b02c6681780e7 (patch) | |
tree | 8cbfcb58bfbe67b2549d76ba721b2db9c33a602b /src/testdir | |
parent | e08795e1ecf0b85751e9f41021603c39ef026d92 (diff) |
patch 8.2.2842: Vim9: skip argument to searchpair() is not compiledv8.2.2842
Problem: Vim9: skip argument to searchpair() is not compiled.
Solution: Add VAR_INSTR.
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 14 | ||||
-rw-r--r-- | src/testdir/test_vim9_disassemble.vim | 29 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 46fe3e5ca8..3232d9b3b7 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -974,6 +974,20 @@ def Test_searchcount() bwipe! enddef +def Test_searchpair() + new + setline(1, "here { and } there") + normal f{ + var col = 15 + assert_equal(1, searchpair('{', '', '}', '', 'col(".") > col')) + assert_equal(12, col('.')) + col = 8 + normal 0f{ + assert_equal(0, searchpair('{', '', '}', '', 'col(".") > col')) + assert_equal(6, col('.')) + bwipe! +enddef + def Test_set_get_bufline() # similar to Test_setbufline_getbufline() var lines =<< trim END diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim index e7314e43f3..c4482a5d9c 100644 --- a/src/testdir/test_vim9_disassemble.vim +++ b/src/testdir/test_vim9_disassemble.vim @@ -140,6 +140,35 @@ def Test_disassemble_substitute() res) enddef + +def s:SearchPair() + var col = 8 + searchpair("{", "", "}", "", "col('.') > col") +enddef + +def Test_disassemble_seachpair() + var res = execute('disass s:SearchPair') + assert_match('<SNR>\d*_SearchPair.*' .. + ' var col = 8\_s*' .. + '\d STORE 8 in $0\_s*' .. + ' searchpair("{", "", "}", "", "col(''.'') > col")\_s*' .. + '\d PUSHS "{"\_s*' .. + '\d PUSHS ""\_s*' .. + '\d PUSHS "}"\_s*' .. + '\d PUSHS ""\_s*' .. + '\d INSTR\_s*' .. + ' 0 PUSHS "."\_s*' .. + ' 1 BCALL col(argc 1)\_s*' .. + ' 2 LOAD $0\_s*' .. + ' 3 COMPARENR >\_s*' .. + ' -------------\_s*' .. + '\d BCALL searchpair(argc 5)\_s*' .. + '\d DROP\_s*' .. + '\d RETURN 0', + res) +enddef + + def s:RedirVar() var result: string redir =>> result |