1" Test glob2regpat() 2 3func Test_invalid() 4 call assert_fails('call glob2regpat(1.33)', 'E806:') 5 call assert_fails('call glob2regpat("}")', 'E219:') 6 call assert_fails('call glob2regpat("{")', 'E220:') 7endfunc 8 9func Test_valid() 10 call assert_equal('^foo\.', glob2regpat('foo.*')) 11 call assert_equal('^foo.$', glob2regpat('foo?')) 12 call assert_equal('\.vim$', glob2regpat('*.vim')) 13 call assert_equal('^[abc]$', glob2regpat('[abc]')) 14 call assert_equal('^foo bar$', glob2regpat('foo\ bar')) 15 call assert_equal('^foo,bar$', glob2regpat('foo,bar')) 16 call assert_equal('^\(foo\|bar\)$', glob2regpat('{foo,bar}')) 17 call assert_equal('.*', glob2regpat('**')) 18 19 if exists('+shellslash') 20 call assert_equal('^foo[\/].$', glob2regpat('foo\?')) 21 call assert_equal('^\(foo[\/]\|bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}')) 22 call assert_equal('^[\/]\(foo\|bar[\/]\)$', glob2regpat('\{foo,bar\}')) 23 call assert_equal('^[\/][\/]\(foo\|bar[\/][\/]\)$', glob2regpat('\\{foo,bar\\}')) 24 else 25 call assert_equal('^foo?$', glob2regpat('foo\?')) 26 call assert_equal('^\(foo,bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}')) 27 call assert_equal('^{foo,bar}$', glob2regpat('\{foo,bar\}')) 28 call assert_equal('^\\\(foo\|bar\\\)$', glob2regpat('\\{foo,bar\\}')) 29 endif 30endfunc 31