Mercurial > vim
comparison src/testdir/test_match.vim @ 12451:61450cb2b6a1 v8.0.1105
patch 8.0.1105: match() and matchend() are not tested
commit https://github.com/vim/vim/commit/1190cf68e27a123cf9f6fb57897782a3b9f7b810
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 14 14:31:18 2017 +0200
patch 8.0.1105: match() and matchend() are not tested
Problem: match() and matchend() are not tested.
Solution: Add tests. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/2088)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 14 Sep 2017 14:45:04 +0200 |
parents | f9de19f981a4 |
children | 631344964949 |
comparison
equal
deleted
inserted
replaced
12450:1c02d9d87d59 | 12451:61450cb2b6a1 |
---|---|
1 " Test for :match, :2match, :3match, clearmatches(), getmatches(), matchadd(), | 1 " Test for :match, :2match, :3match, clearmatches(), getmatches(), matchadd(), |
2 " matchaddpos(), matcharg(), matchdelete(), matchstrpos() and setmatches(). | 2 " matchaddpos(), matcharg(), matchdelete(), and setmatches(). |
3 | 3 |
4 function Test_match() | 4 function Test_match() |
5 highlight MyGroup1 term=bold ctermbg=red guibg=red | 5 highlight MyGroup1 term=bold ctermbg=red guibg=red |
6 highlight MyGroup2 term=italic ctermbg=green guibg=green | 6 highlight MyGroup2 term=italic ctermbg=green guibg=green |
7 highlight MyGroup3 term=underline ctermbg=blue guibg=blue | 7 highlight MyGroup3 term=underline ctermbg=blue guibg=blue |
148 highlight MyGroup1 NONE | 148 highlight MyGroup1 NONE |
149 highlight MyGroup2 NONE | 149 highlight MyGroup2 NONE |
150 highlight MyGroup3 NONE | 150 highlight MyGroup3 NONE |
151 endfunc | 151 endfunc |
152 | 152 |
153 func Test_matchstrpos() | |
154 call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing')) | |
155 call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2)) | |
156 call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5)) | |
157 call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 8)) | |
158 call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing')) | |
159 call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img')) | |
160 endfunc | |
161 | |
162 func Test_matchaddpos() | 153 func Test_matchaddpos() |
163 syntax on | 154 syntax on |
164 set hlsearch | 155 set hlsearch |
165 | 156 |
166 call setline(1, ['12345', 'NP']) | 157 call setline(1, ['12345', 'NP']) |