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