Mercurial > vim
comparison src/testdir/test_functions.vim @ 17930:0cdb6ac20748 v8.1.1961
patch 8.1.1961: more functions can be used as a method
Commit: https://github.com/vim/vim/commit/a1449836334355b1fb00cd1bf083e7d353f6c4d7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 1 20:16:52 2019 +0200
patch 8.1.1961: more functions can be used as a method
Problem: More functions can be used as a method.
Solution: Allow more functions to be used as a method. Add a test for
mapcheck().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Sep 2019 20:30:04 +0200 |
parents | 2e53305f2239 |
children | 745c02392844 |
comparison
equal
deleted
inserted
replaced
17929:3d3ccf634254 | 17930:0cdb6ac20748 |
---|---|
653 call assert_equal('R-Rc', g:current_modes) | 653 call assert_equal('R-Rc', g:current_modes) |
654 " R_CTRL-X CTRL-L: No match | 654 " R_CTRL-X CTRL-L: No match |
655 exe "normal Rabc\<C-X>\<C-L>\<F2>\<Esc>u" | 655 exe "normal Rabc\<C-X>\<C-L>\<F2>\<Esc>u" |
656 call assert_equal('R-Rc', g:current_modes) | 656 call assert_equal('R-Rc', g:current_modes) |
657 | 657 |
658 call assert_equal('n', mode(0)) | 658 call assert_equal('n', 0->mode()) |
659 call assert_equal('n', mode(1)) | 659 call assert_equal('n', 1->mode()) |
660 | 660 |
661 " i_CTRL-O | 661 " i_CTRL-O |
662 exe "normal i\<C-O>:call Save_mode()\<Cr>\<Esc>" | 662 exe "normal i\<C-O>:call Save_mode()\<Cr>\<Esc>" |
663 call assert_equal("n-niI", g:current_modes) | 663 call assert_equal("n-niI", g:current_modes) |
664 | 664 |
791 call assert_equal(-1, strridx('hello', 'hello world')) | 791 call assert_equal(-1, strridx('hello', 'hello world')) |
792 endfunc | 792 endfunc |
793 | 793 |
794 func Test_match_func() | 794 func Test_match_func() |
795 call assert_equal(4, match('testing', 'ing')) | 795 call assert_equal(4, match('testing', 'ing')) |
796 call assert_equal(4, match('testing', 'ing', 2)) | 796 call assert_equal(4, 'testing'->match('ing', 2)) |
797 call assert_equal(-1, match('testing', 'ing', 5)) | 797 call assert_equal(-1, match('testing', 'ing', 5)) |
798 call assert_equal(-1, match('testing', 'ing', 8)) | 798 call assert_equal(-1, match('testing', 'ing', 8)) |
799 call assert_equal(1, match(['vim', 'testing', 'execute'], 'ing')) | 799 call assert_equal(1, match(['vim', 'testing', 'execute'], 'ing')) |
800 call assert_equal(-1, match(['vim', 'testing', 'execute'], 'img')) | 800 call assert_equal(-1, match(['vim', 'testing', 'execute'], 'img')) |
801 endfunc | 801 endfunc |
802 | 802 |
803 func Test_matchend() | 803 func Test_matchend() |
804 call assert_equal(7, matchend('testing', 'ing')) | 804 call assert_equal(7, matchend('testing', 'ing')) |
805 call assert_equal(7, matchend('testing', 'ing', 2)) | 805 call assert_equal(7, 'testing'->matchend('ing', 2)) |
806 call assert_equal(-1, matchend('testing', 'ing', 5)) | 806 call assert_equal(-1, matchend('testing', 'ing', 5)) |
807 call assert_equal(-1, matchend('testing', 'ing', 8)) | 807 call assert_equal(-1, matchend('testing', 'ing', 8)) |
808 call assert_equal(match(['vim', 'testing', 'execute'], 'ing'), matchend(['vim', 'testing', 'execute'], 'ing')) | 808 call assert_equal(match(['vim', 'testing', 'execute'], 'ing'), matchend(['vim', 'testing', 'execute'], 'ing')) |
809 call assert_equal(match(['vim', 'testing', 'execute'], 'img'), matchend(['vim', 'testing', 'execute'], 'img')) | 809 call assert_equal(match(['vim', 'testing', 'execute'], 'img'), matchend(['vim', 'testing', 'execute'], 'img')) |
810 endfunc | 810 endfunc |
811 | 811 |
812 func Test_matchlist() | 812 func Test_matchlist() |
813 call assert_equal(['acd', 'a', '', 'c', 'd', '', '', '', '', ''], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)')) | 813 call assert_equal(['acd', 'a', '', 'c', 'd', '', '', '', '', ''], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)')) |
814 call assert_equal(['d', '', '', '', 'd', '', '', '', '', ''], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2)) | 814 call assert_equal(['d', '', '', '', 'd', '', '', '', '', ''], 'acd'->matchlist('\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2)) |
815 call assert_equal([], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 4)) | 815 call assert_equal([], matchlist('acd', '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 4)) |
816 endfunc | 816 endfunc |
817 | 817 |
818 func Test_matchstr() | 818 func Test_matchstr() |
819 call assert_equal('ing', matchstr('testing', 'ing')) | 819 call assert_equal('ing', matchstr('testing', 'ing')) |
820 call assert_equal('ing', matchstr('testing', 'ing', 2)) | 820 call assert_equal('ing', 'testing'->matchstr('ing', 2)) |
821 call assert_equal('', matchstr('testing', 'ing', 5)) | 821 call assert_equal('', matchstr('testing', 'ing', 5)) |
822 call assert_equal('', matchstr('testing', 'ing', 8)) | 822 call assert_equal('', matchstr('testing', 'ing', 8)) |
823 call assert_equal('testing', matchstr(['vim', 'testing', 'execute'], 'ing')) | 823 call assert_equal('testing', matchstr(['vim', 'testing', 'execute'], 'ing')) |
824 call assert_equal('', matchstr(['vim', 'testing', 'execute'], 'img')) | 824 call assert_equal('', matchstr(['vim', 'testing', 'execute'], 'img')) |
825 endfunc | 825 endfunc |
826 | 826 |
827 func Test_matchstrpos() | 827 func Test_matchstrpos() |
828 call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing')) | 828 call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing')) |
829 call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2)) | 829 call assert_equal(['ing', 4, 7], 'testing'->matchstrpos('ing', 2)) |
830 call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5)) | 830 call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5)) |
831 call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 8)) | 831 call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 8)) |
832 call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing')) | 832 call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing')) |
833 call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img')) | 833 call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img')) |
834 endfunc | 834 endfunc |