summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-20 16:57:02 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-20 16:57:02 +0200
commit66e29d7112e437b2b50efe1f82c7e892736d23e4 (patch)
treea99f9f43e0fc5b56f13cb1426b1fa78f8319632c /src/testdir
parentf04507d132fbcb63999167ec006fc6e700b5af4f (diff)
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')
-rw-r--r--src/testdir/Make_all.mak1
-rw-r--r--src/testdir/test_alot.vim1
-rw-r--r--src/testdir/test_tagcase.in57
-rw-r--r--src/testdir/test_tagcase.ok76
-rw-r--r--src/testdir/test_tagcase.vim73
5 files changed, 74 insertions, 134 deletions
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 19973d5425..3a0742d64c 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -100,7 +100,6 @@ SCRIPTS_ALL = \
test_marks.out \
test_nested_function.out \
test_search_mbyte.out \
- test_tagcase.out \
test_utf8.out \
test_wordcount.out \
test_writefile.out
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
index daf5b0ad04..b89d4b0db4 100644
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -35,6 +35,7 @@ source test_statusline.vim
source test_syn_attr.vim
source test_tabline.vim
source test_tabpage.vim
+source test_tagcase.vim
source test_tagjump.vim
source test_timers.vim
source test_true_false.vim
diff --git a/src/testdir/test_tagcase.in b/src/testdir/test_tagcase.in
deleted file mode 100644
index d76dbab997..0000000000
--- a/src/testdir/test_tagcase.in
+++ /dev/null
@@ -1,57 +0,0 @@
-Tests for 'tagcase' option
-
-STARTTEST
-:so small.vim
-:lang mess C
-:/^start text$/+1,/^end text$/w! Xtext
-:/^start tags$/+1,/^end tags$/-1w! Xtags
-:set tags=Xtags
-:e Xtext
-:"
-:" Verify default values.
-:set ic& | setg tc& | setl tc&
-:call append('$', "ic=".&ic." g:tc=".&g:tc." l:tc=".&l:tc." tc=".&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.
-:let v:errmsg = ""
-:setl tc=
-:call append('$', v:errmsg)
-:let v:errmsg = ""
-:setg tc=
-:call append('$', v:errmsg)
-:let v:errmsg = ""
-:set tc=
-:call append('$', v:errmsg)
-:"
-:" Verify that the correct number of matching tags is found for all values of
-:" 'ignorecase' and global and local values 'tagcase', in all combinations.
-:for &ic in [0, 1]
-: for &g:tc in ["followic", "ignore", "match"]
-: for &l:tc in ["", "followic", "ignore", "match"]
-: call append('$', "ic=".&ic." g:tc=".&g:tc." l:tc=".&l:tc." tc=".&tc)
-: call append('$', len(taglist("^foo$")))
-: call append('$', len(taglist("^Foo$")))
-: endfor
-: endfor
-:endfor
-:"
-:1,/^end text$/d
-:w! test.out
-:qa!
-ENDTEST
-
-start text
-
-Foo
-Bar
-foo
-
-end text
-
-start tags
-Bar Xtext 3
-Foo Xtext 2
-foo Xtext 4
-end tags
diff --git a/src/testdir/test_tagcase.ok b/src/testdir/test_tagcase.ok
deleted file mode 100644
index fe161cf387..0000000000
--- a/src/testdir/test_tagcase.ok
+++ /dev/null
@@ -1,76 +0,0 @@
-ic=0 g:tc=followic l:tc=followic tc=followic
-
-E474: Invalid argument: tc=
-E474: Invalid argument: tc=
-ic=0 g:tc=followic l:tc= tc=followic
-1
-1
-ic=0 g:tc=followic l:tc=followic tc=followic
-1
-1
-ic=0 g:tc=followic l:tc=ignore tc=ignore
-2
-2
-ic=0 g:tc=followic l:tc=match tc=match
-1
-1
-ic=0 g:tc=ignore l:tc= tc=ignore
-2
-2
-ic=0 g:tc=ignore l:tc=followic tc=followic
-1
-1
-ic=0 g:tc=ignore l:tc=ignore tc=ignore
-2
-2
-ic=0 g:tc=ignore l:tc=match tc=match
-1
-1
-ic=0 g:tc=match l:tc= tc=match
-1
-1
-ic=0 g:tc=match l:tc=followic tc=followic
-1
-1
-ic=0 g:tc=match l:tc=ignore tc=ignore
-2
-2
-ic=0 g:tc=match l:tc=match tc=match
-1
-1
-ic=1 g:tc=followic l:tc= tc=followic
-2
-2
-ic=1 g:tc=followic l:tc=followic tc=followic
-2
-2
-ic=1 g:tc=followic l:tc=ignore tc=ignore
-2
-2
-ic=1 g:tc=followic l:tc=match tc=match
-1
-1
-ic=1 g:tc=ignore l:tc= tc=ignore
-2
-2
-ic=1 g:tc=ignore l:tc=followic tc=followic
-2
-2
-ic=1 g:tc=ignore l:tc=ignore tc=ignore
-2
-2
-ic=1 g:tc=ignore l:tc=match tc=match
-1
-1
-ic=1 g:tc=match l:tc= tc=match
-1
-1
-ic=1 g:tc=match l:tc=followic tc=followic
-2
-2
-ic=1 g:tc=match l:tc=ignore tc=ignore
-2
-2
-ic=1 g:tc=match l:tc=match tc=match
-1
-1
diff --git a/src/testdir/test_tagcase.vim b/src/testdir/test_tagcase.vim
new file mode 100644
index 0000000000..83e532822d
--- /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