annotate src/testdir/test_tagjump.vim @ 10611:6bff81438f27 v8.0.0195

patch 8.0.0195: fail to jump to static tag in current file commit https://github.com/vim/vim/commit/a9d23c20879d0dcb289a4db54b3c7df060f87c3c Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 16 20:53:34 2017 +0100 patch 8.0.0195: fail to jump to static tag in current file Problem: Jumping to a tag that is a static item in the current file fails. (Kazunobu Kuriyama) Solution: Make sure the first byte of the tag key is not NUL. (Suggested by James McCoy, closes #1387)
author Christian Brabandt <cb@256bit.org>
date Mon, 16 Jan 2017 21:00:04 +0100
parents eb9a7296ae9f
children 0ecd07cd2e43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8934
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for tagjump (tags and special searches)
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " SEGV occurs in older versions. (At least 7.4.1748 or older)
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 func Test_ptag_with_notagstack()
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 set notagstack
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 call assert_fails('ptag does_not_exist_tag_name', 'E426')
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 set tagstack&vim
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 endfunc
9228
ea504064c996 commit https://github.com/vim/vim/commit/fd89d7ea81b18d32363456b16258174dc9e095dc
Christian Brabandt <cb@256bit.org>
parents: 8934
diff changeset
9
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
10 func Test_cancel_ptjump()
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
11 set tags=Xtags
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
12 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
13 \ "word\tfile1\tcmd1",
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
14 \ "word\tfile2\tcmd2"],
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
15 \ 'Xtags')
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
16
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
17 only!
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
18 call feedkeys(":ptjump word\<CR>\<CR>", "xt")
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
19 help
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
20 call assert_equal(2, winnr('$'))
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
21
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
22 call delete('Xtags')
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
23 quit
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
24 endfunc
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
25
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
26 func Test_static_tagjump()
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
27 set tags=Xtags
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
28 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
29 \ "one\tXfile1\t/^one/;\"\tf\tfile:\tsignature:(void)",
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
30 \ "word\tXfile2\tcmd2"],
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
31 \ 'Xtags')
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
32 new Xfile1
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
33 call setline(1, ['empty', 'one()', 'empty'])
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
34 write
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
35 tag one
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
36 call assert_equal(2, line('.'))
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
37
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
38 set tags&
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
39 call delete('Xtags')
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
40 call delete('Xfile1')
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
41 bwipe!
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
42 endfunc
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
43
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
44 " Tests for [ CTRL-I and CTRL-W CTRL-I commands
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
45 function Test_keyword_jump()
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
46 call writefile(["#include Xinclude", "",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
47 \ "",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
48 \ "/* test text test tex start here",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
49 \ " some text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
50 \ " test text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
51 \ " start OK if found this line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
52 \ " start found wrong line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
53 \ "test text"], 'Xtestfile')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
54 call writefile(["/* test text test tex start here",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
55 \ " some text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
56 \ " test text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
57 \ " start OK if found this line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
58 \ " start found wrong line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
59 \ "test text"], 'Xinclude')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
60 new Xtestfile
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
61 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
62 call search("start")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
63 exe "normal! 5[\<C-I>"
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
64 call assert_equal(" start OK if found this line", getline('.'))
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
65 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
66 call search("start")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
67 exe "normal! 5\<C-W>\<C-I>"
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
68 call assert_equal(" start OK if found this line", getline('.'))
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
69 enew! | only
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
70 call delete('Xtestfile')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
71 call delete('Xinclude')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
72 endfunction
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
73
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9228
diff changeset
74 " vim: shiftwidth=2 sts=2 expandtab