diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-20 16:57:02 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-20 16:57:02 +0200 |
commit | 66e29d7112e437b2b50efe1f82c7e892736d23e4 (patch) | |
tree | a99f9f43e0fc5b56f13cb1426b1fa78f8319632c /src/testdir/test_tagcase.vim | |
parent | f04507d132fbcb63999167ec006fc6e700b5af4f (diff) | |
download | vim-git-66e29d7112e437b2b50efe1f82c7e892736d23e4.tar.gz |
patch 7.4.2230v7.4.2230
Problem: There is no equivalent of 'smartcase' for a tag search.
Solution: Add value "followscs" and "smart" to 'tagcase'. (Christian
Brabandt, closes #712) Turn tagcase test into new style.
Diffstat (limited to 'src/testdir/test_tagcase.vim')
-rw-r--r-- | src/testdir/test_tagcase.vim | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/testdir/test_tagcase.vim b/src/testdir/test_tagcase.vim new file mode 100644 index 000000000..83e532822 --- /dev/null +++ b/src/testdir/test_tagcase.vim @@ -0,0 +1,73 @@ +" test 'tagcase' option + +func Test_tagcase() + call writefile(["Bar\tXtext\t3", "Foo\tXtext\t2", "foo\tXtext\t4"], 'Xtags') + set tags=Xtags + e Xtext + + for &ic in [0, 1] + for &scs in [0, 1] + for &g:tc in ["followic", "ignore", "match", "followscs", "smart"] + for &l:tc in ["", "followic", "ignore", "match", "followscs", "smart"] + let smart = 0 + if &l:tc != '' + let tc = &l:tc + else + let tc = &g:tc + endif + if tc == 'followic' + let ic = &ic + elseif tc == 'ignore' + let ic = 1 + elseif tc == 'followscs' + let ic = &ic + let smart = &scs + elseif tc == 'smart' + let ic = 1 + let smart = 1 + else + let ic = 0 + endif + if ic && smart + call assert_equal(['foo', 'Foo'], map(taglist("^foo$"), {i, v -> v.name})) + call assert_equal(['Foo'], map(taglist("^Foo$"), {i, v -> v.name})) + elseif ic + call assert_equal(['foo', 'Foo'], map(taglist("^foo$"), {i, v -> v.name})) + call assert_equal(['Foo', 'foo'], map(taglist("^Foo$"), {i, v -> v.name})) + else + call assert_equal(['foo'], map(taglist("^foo$"), {i, v -> v.name})) + call assert_equal(['Foo'], map(taglist("^Foo$"), {i, v -> v.name})) + endif + endfor + endfor + endfor + endfor + + call delete('Xtags') + set ic& + setg tc& + setl tc& + set scs& +endfunc + +func Test_set_tagcase() + " Verify default values. + set ic& + setg tc& + setl tc& + call assert_equal(0, &ic) + call assert_equal('followic', &g:tc) + call assert_equal('followic', &l:tc) + call assert_equal('followic', &tc) + + " Verify that the local setting accepts <empty> but that the global setting + " does not. The first of these (setting the local value to <empty>) should + " succeed; the other two should fail. + setl tc= + call assert_fails('setg tc=', 'E474:') + call assert_fails('set tc=', 'E474:') + + set ic& + setg tc& + setl tc& +endfunc |