1" test 'tagcase' option 2 3func Test_tagcase() 4 call writefile(["Bar\tXtext\t3", "Foo\tXtext\t2", "foo\tXtext\t4"], 'Xtags') 5 set tags=Xtags 6 e Xtext 7 8 for &ic in [0, 1] 9 for &scs in [0, 1] 10 for &g:tc in ["followic", "ignore", "match", "followscs", "smart"] 11 for &l:tc in ["", "followic", "ignore", "match", "followscs", "smart"] 12 let smart = 0 13 if &l:tc != '' 14 let tc = &l:tc 15 else 16 let tc = &g:tc 17 endif 18 if tc == 'followic' 19 let ic = &ic 20 elseif tc == 'ignore' 21 let ic = 1 22 elseif tc == 'followscs' 23 let ic = &ic 24 let smart = &scs 25 elseif tc == 'smart' 26 let ic = 1 27 let smart = 1 28 else 29 let ic = 0 30 endif 31 if ic && smart 32 call assert_equal(['foo', 'Foo'], map(taglist("^foo$"), {i, v -> v.name})) 33 call assert_equal(['Foo'], map(taglist("^Foo$"), {i, v -> v.name})) 34 elseif ic 35 call assert_equal(['foo', 'Foo'], map(taglist("^foo$"), {i, v -> v.name})) 36 call assert_equal(['Foo', 'foo'], map(taglist("^Foo$"), {i, v -> v.name})) 37 else 38 call assert_equal(['foo'], map(taglist("^foo$"), {i, v -> v.name})) 39 call assert_equal(['Foo'], map(taglist("^Foo$"), {i, v -> v.name})) 40 endif 41 endfor 42 endfor 43 endfor 44 endfor 45 46 call delete('Xtags') 47 set ic& 48 setg tc& 49 setl tc& 50 set scs& 51endfunc 52 53func Test_set_tagcase() 54 " Verify default values. 55 set ic& 56 setg tc& 57 setl tc& 58 call assert_equal(0, &ic) 59 call assert_equal('followic', &g:tc) 60 call assert_equal('followic', &l:tc) 61 call assert_equal('followic', &tc) 62 63 " Verify that the local setting accepts <empty> but that the global setting 64 " does not. The first of these (setting the local value to <empty>) should 65 " succeed; the other two should fail. 66 setl tc= 67 call assert_fails('setg tc=', 'E474:') 68 call assert_fails('set tc=', 'E474:') 69 70 set ic& 71 setg tc& 72 setl tc& 73endfunc 74