Mercurial > vim
comparison src/testdir/test_match.vim @ 12248:f9de19f981a4 v8.0.1004
patch 8.0.1004: matchstrpos() without a match returns too many items
commit https://github.com/vim/vim/commit/8d9f0ef5c6a6f6d19c3d02690e1ee347a70b8452
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 27 13:51:01 2017 +0200
patch 8.0.1004: matchstrpos() without a match returns too many items
Problem: Matchstrpos() without a match returns too many items.
Solution: Also remove the second item when the position is beyond the end of
the string. (Hirohito Higashi) Use an enum for the type.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 27 Aug 2017 14:00:05 +0200 |
parents | 1c1fcf515607 |
children | 61450cb2b6a1 |
comparison
equal
deleted
inserted
replaced
12247:e7de239b1e9f | 12248:f9de19f981a4 |
---|---|
150 highlight MyGroup3 NONE | 150 highlight MyGroup3 NONE |
151 endfunc | 151 endfunc |
152 | 152 |
153 func Test_matchstrpos() | 153 func Test_matchstrpos() |
154 call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing')) | 154 call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing')) |
155 | |
156 call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2)) | 155 call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2)) |
157 | |
158 call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5)) | 156 call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5)) |
159 | 157 call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 8)) |
160 call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing')) | 158 call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing')) |
161 | |
162 call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img')) | 159 call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img')) |
163 endfunc | 160 endfunc |
164 | 161 |
165 func Test_matchaddpos() | 162 func Test_matchaddpos() |
166 syntax on | 163 syntax on |