Mercurial > vim
comparison src/testdir/test_glob2regpat.vim @ 9820:6882920b42da v7.4.2185
commit https://github.com/vim/vim/commit/71dd9744cf3842cd45295010d2e5692da1651537
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Aug 8 22:42:04 2016 +0200
patch 7.4.2185
Problem: Test glob2regpat does not test much.
Solution: Add a few more test cases. (Dominique Pelle)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 08 Aug 2016 22:45:06 +0200 |
parents | c9daa07abf34 |
children | 0524e72c9023 |
comparison
equal
deleted
inserted
replaced
9819:0ef07b2fb326 | 9820:6882920b42da |
---|---|
1 " Test glob2regpat() | 1 " Test glob2regpat() |
2 | 2 |
3 func Test_invalid() | 3 func Test_invalid() |
4 call assert_fails('call glob2regpat(1.33)', 'E806:') | 4 call assert_fails('call glob2regpat(1.33)', 'E806:') |
5 call assert_fails('call glob2regpat("}")', 'E219:') | |
6 call assert_fails('call glob2regpat("{")', 'E220:') | |
5 endfunc | 7 endfunc |
6 | 8 |
7 func Test_valid() | 9 func Test_valid() |
8 call assert_equal('^foo\.', glob2regpat('foo.*')) | 10 call assert_equal('^foo\.', glob2regpat('foo.*')) |
11 call assert_equal('^foo.$', glob2regpat('foo?')) | |
12 call assert_equal('^foo?$', glob2regpat('foo\?')) | |
9 call assert_equal('\.vim$', glob2regpat('*.vim')) | 13 call assert_equal('\.vim$', glob2regpat('*.vim')) |
14 call assert_equal('^[abc]$', glob2regpat('[abc]')) | |
15 call assert_equal('^foo bar$', glob2regpat('foo\ bar')) | |
16 call assert_equal('^foo,bar$', glob2regpat('foo,bar')) | |
17 call assert_equal('^\(foo\|bar\)$', glob2regpat('{foo,bar}')) | |
18 call assert_equal('^\(foo,bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}')) | |
19 call assert_equal('^{foo,bar}$', glob2regpat('\{foo,bar\}')) | |
20 call assert_equal('^\\\(foo\|bar\\\)$', glob2regpat('\\{foo,bar\\}')) | |
21 call assert_equal('.*', glob2regpat('**')) | |
10 endfunc | 22 endfunc |