annotate src/testdir/test_cscope.vim @ 29249:0b47ef4e19b8 v8.2.5143

patch 8.2.5143: some tests fail when using valgrind Commit: https://github.com/vim/vim/commit/37bb3b111d08ce420e3cfd6ea3da3ed7428fbed1 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 21 17:40:47 2022 +0100 patch 8.2.5143: some tests fail when using valgrind Problem: Some tests fail when using valgrind. Spurious leak reports. Solution: Use WaitForAssert(). Avoid failing fork/exec. Skip tests where a job is killed when running valgrind.
author Bram Moolenaar <Bram@vim.org>
date Tue, 21 Jun 2022 18:45:08 +0200
parents 92e0b1f2b72f
children f7a2de8a4ddc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9505
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for cscope commands.
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
3 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
4 CheckFeature cscope
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
5 CheckFeature quickfix
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
6 CheckExecutable cscope
9505
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
8 func CscopeSetupOrClean(setup)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
9 if a:setup
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
10 noa sp ../memfile_test.c
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
11 saveas! Xmemfile_test.c
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
12 call system('cscope -bk -fXcscope.out Xmemfile_test.c')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
13 call system('cscope -bk -fXcscope2.out Xmemfile_test.c')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
14 cscope add Xcscope.out
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
15 set cscopequickfix=s-,g-,d-,c-,t-,e-,f-,i-,a-
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
16 else
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
17 cscope kill -1
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
18 for file in ['Xcscope.out', 'Xcscope2.out', 'Xmemfile_test.c']
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
19 call delete(file)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
20 endfo
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
21 endif
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
22 endfunc
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
23
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
24 func Test_cscopeWithCscopeConnections()
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
25 call CscopeSetupOrClean(1)
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
26 " Test: E568: duplicate cscope database not added
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
27 try
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
28 set nocscopeverbose
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
29 cscope add Xcscope.out
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
30 set cscopeverbose
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
31 catch
11183
1c4ebbae41d2 patch 8.0.0478: tests use assert_true(0) and assert_false(1) to report errors
Christian Brabandt <cb@256bit.org>
parents: 10046
diff changeset
32 call assert_report('exception thrown')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
33 endtry
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
34 call assert_fails('cscope add', 'E560:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
35 call assert_fails('cscope add Xcscope.out', 'E568:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
36 call assert_fails('cscope add doesnotexist.out', 'E563:')
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
37 if has('unix')
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
38 call assert_fails('cscope add /dev/null', 'E564:')
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
39 endif
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
40
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
41 " Test: Find this C-Symbol
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
42 for cmd in ['cs find s main', 'cs find 0 main']
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
43 let a = execute(cmd)
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
44 " Test where it moves the cursor
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
45 call assert_equal('main(void)', getline('.'))
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
46 " Test the output of the :cs command
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
47 call assert_match('\n(1 of 1): <<main>> main(void )', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
48 endfor
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
49
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
50 " Test: Find this definition
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
51 for cmd in ['cs find g test_mf_hash',
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
52 \ 'cs find 1 test_mf_hash',
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
53 \ 'cs find 1 test_mf_hash'] " leading space ignored.
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
54 exe cmd
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
55 call assert_equal(['', '/*', ' * Test mf_hash_*() functions.', ' */', ' static void', 'test_mf_hash(void)', '{'], getline(line('.')-5, line('.')+1))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
56 endfor
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
57
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
58 " Test: Find functions called by this function
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
59 for cmd in ['cs find d test_mf_hash', 'cs find 2 test_mf_hash']
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
60 let a = execute(cmd)
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
61 call assert_match('\n(1 of 42): <<mf_hash_init>> mf_hash_init(&ht);', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
62 call assert_equal(' mf_hash_init(&ht);', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
63 endfor
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
64
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
65 " Test: Find functions calling this function
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
66 for cmd in ['cs find c test_mf_hash', 'cs find 3 test_mf_hash']
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
67 let a = execute(cmd)
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
68 call assert_match('\n(1 of 1): <<main>> test_mf_hash();', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
69 call assert_equal(' test_mf_hash();', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
70 endfor
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
71
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
72 " Test: Find this text string
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
73 for cmd in ['cs find t Bram', 'cs find 4 Bram']
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
74 let a = execute(cmd)
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
75 call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
76 call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
77 endfor
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
78
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
79 " Test: Find this egrep pattern
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
80 " test all matches returned by cscope
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
81 for cmd in ['cs find e ^\#includ.', 'cs find 6 ^\#includ.']
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
82 let a = execute(cmd)
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
83 call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
84 call assert_equal('#include <assert.h>', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
85 cnext
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
86 call assert_equal('#include "main.c"', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
87 cnext
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
88 call assert_equal('#include "memfile.c"', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
89 call assert_fails('cnext', 'E553:')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
90 endfor
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
91
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
92 " Test: Find the same egrep pattern using lcscope this time.
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
93 let a = execute('lcs find e ^\#includ.')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
94 call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
95 call assert_equal('#include <assert.h>', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
96 lnext
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
97 call assert_equal('#include "main.c"', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
98 lnext
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
99 call assert_equal('#include "memfile.c"', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
100 call assert_fails('lnext', 'E553:')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
101
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
102 " Test: Find this file
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
103 for cmd in ['cs find f Xmemfile_test.c', 'cs find 7 Xmemfile_test.c']
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
104 enew
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
105 let a = execute(cmd)
21154
9f9c26b3ddc5 patch 8.2.1128: the write message mentions characters, but it's bytes
Bram Moolenaar <Bram@vim.org>
parents: 19910
diff changeset
106 call assert_true(a =~ '"Xmemfile_test.c" \d\+L, \d\+B')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
107 call assert_equal('Xmemfile_test.c', @%)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
108 endfor
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
109
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
110 " Test: Find files #including this file
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
111 for cmd in ['cs find i assert.h', 'cs find 8 assert.h']
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
112 enew
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
113 let a = execute(cmd)
10046
4a07f8de5efa commit https://github.com/vim/vim/commit/4792255eff03760dca0fd014616532e6d47db364
Christian Brabandt <cb@256bit.org>
parents: 9800
diff changeset
114 let alines = split(a, '\n', 1)
4a07f8de5efa commit https://github.com/vim/vim/commit/4792255eff03760dca0fd014616532e6d47db364
Christian Brabandt <cb@256bit.org>
parents: 9800
diff changeset
115 call assert_equal('', alines[0])
21154
9f9c26b3ddc5 patch 8.2.1128: the write message mentions characters, but it's bytes
Bram Moolenaar <Bram@vim.org>
parents: 19910
diff changeset
116 call assert_true(alines[1] =~ '"Xmemfile_test.c" \d\+L, \d\+B')
10046
4a07f8de5efa commit https://github.com/vim/vim/commit/4792255eff03760dca0fd014616532e6d47db364
Christian Brabandt <cb@256bit.org>
parents: 9800
diff changeset
117 call assert_equal('(1 of 1): <<global>> #include <assert.h>', alines[2])
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
118 call assert_equal('#include <assert.h>', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
119 endfor
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
120
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
121 " Test: Invalid find command
24691
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
122 call assert_fails('cs find', 'E560:')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
123 call assert_fails('cs find x', 'E560:')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
124
19249
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
125 if has('float')
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
126 " Test: Find places where this symbol is assigned a value
19249
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
127 " this needs a cscope >= 15.8
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
128 " unfortunately, Travis has cscope version 15.7
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
129 let cscope_version = systemlist('cscope --version')[0]
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
130 let cs_version = str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?'))
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
131 if cs_version >= 15.8
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
132 for cmd in ['cs find a item', 'cs find 9 item']
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
133 let a = execute(cmd)
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
134 call assert_equal(['', '(1 of 4): <<test_mf_hash>> item = LALLOC_CLEAR_ONE(mf_hashitem_T);'], split(a, '\n', 1))
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
135 call assert_equal(' item = LALLOC_CLEAR_ONE(mf_hashitem_T);', getline('.'))
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
136 cnext
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
137 call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
138 cnext
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
139 call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
140 cnext
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
141 call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
142 endfor
2a017e9dc6da patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
143 endif
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
144 endif
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
145
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
146 " Test: leading whitespace is not removed for cscope find text
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
147 let a = execute('cscope find t test_mf_hash')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
148 call assert_equal(['', '(1 of 1): <<<unknown>>> test_mf_hash();'], split(a, '\n', 1))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
149 call assert_equal(' test_mf_hash();', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
150
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
151 " Test: test with scscope
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
152 let a = execute('scs find t Bram')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
153 call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
154 call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
155
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
156 " Test: cscope help
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
157 for cmd in ['cs', 'cs help', 'cs xxx']
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
158 let a = execute(cmd)
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
159 call assert_match('^cscope commands:\n', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
160 call assert_match('\nadd :', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
161 call assert_match('\nfind :', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
162 call assert_match('\nhelp : Show this message', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
163 call assert_match('\nkill : Kill a connection', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
164 call assert_match('\nreset: Reinit all connections', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
165 call assert_match('\nshow : Show connections', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
166 endfor
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
167 let a = execute('scscope help')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
168 call assert_match('This cscope command does not support splitting the window\.', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
169
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
170 " Test: reset connections
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
171 let a = execute('cscope reset')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
172 call assert_match('\nAdded cscope database.*Xcscope.out (#0)', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
173 call assert_match('\nAll cscope databases reset', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
174
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
175 " Test: cscope show
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
176 let a = execute('cscope show')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
177 call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
178
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
179 " Test: cstag and 'csto' option
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
180 set csto=0
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
181 let a = execute('cstag TEST_COUNT')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
182 call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
183 call assert_equal('#define TEST_COUNT 50000', getline('.'))
24691
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
184 call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
185 set csto=1
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
186 let a = execute('cstag index_to_key')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
187 call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
188 call assert_equal('#define index_to_key(i) ((i) ^ 15167)', getline('.'))
24691
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
189 call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
190 call assert_fails('cstag', 'E562:')
24691
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
191 let save_tags = &tags
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
192 set tags=
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
193 call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
194 let a = execute('cstag index_to_key')
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
195 call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
196 let &tags = save_tags
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
197
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
198 " Test: 'cst' option
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
199 set nocst
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21154
diff changeset
200 call assert_fails('tag TEST_COUNT', 'E433:')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
201 set cst
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
202 let a = execute('tag TEST_COUNT')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
203 call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
204 call assert_equal('#define TEST_COUNT 50000', getline('.'))
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
205 let a = execute('tags')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
206 call assert_match('1 1 TEST_COUNT\s\+\d\+\s\+#define index_to_key', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
207
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
208 " Test: 'cscoperelative'
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
209 call mkdir('Xcscoperelative')
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
210 cd Xcscoperelative
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
211 let a = execute('cs find g test_mf_hash')
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
212 call assert_notequal('test_mf_hash(void)', getline('.'))
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
213 set cscoperelative
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
214 let a = execute('cs find g test_mf_hash')
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
215 call assert_equal('test_mf_hash(void)', getline('.'))
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
216 set nocscoperelative
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
217 cd ..
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
218 call delete('Xcscoperelative', 'd')
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
219
24691
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
220 " Test: E259: no match found
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
221 call assert_fails('cscope find g DOES_NOT_EXIST', 'E259:')
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
222
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
223 " Test: this should trigger call to cs_print_tags()
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
224 " Unclear how to check result though, we just exercise the code.
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
225 set cst cscopequickfix=s0
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
226 call feedkeys(":cs find s main\<CR>", 't')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
227
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
228 " Test: cscope kill
24691
18545ce744c4 patch 8.2.2884: not enough cscope code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
229 call assert_fails('cscope kill', 'E560:')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
230 call assert_fails('cscope kill 2', 'E261:')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
231 call assert_fails('cscope kill xxx', 'E261:')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
232
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
233 let a = execute('cscope kill 0')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
234 call assert_match('cscope connection 0 closed', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
235
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
236 cscope add Xcscope.out
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
237 let a = execute('cscope kill Xcscope.out')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
238 call assert_match('cscope connection Xcscope.out closed', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
239
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
240 cscope add Xcscope.out .
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
241 let a = execute('cscope kill -1')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
242 call assert_match('cscope connection .*Xcscope.out closed', a)
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
243 let a = execute('cscope kill -1')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
244 call assert_equal('', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
245
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
246 " Test: 'csprg' option
29249
0b47ef4e19b8 patch 8.2.5143: some tests fail when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 27104
diff changeset
247 " Skip this with valgrind, it causes spurious leak reports
0b47ef4e19b8 patch 8.2.5143: some tests fail when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 27104
diff changeset
248 if !RunningWithValgrind()
0b47ef4e19b8 patch 8.2.5143: some tests fail when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 27104
diff changeset
249 call assert_equal('cscope', &csprg)
0b47ef4e19b8 patch 8.2.5143: some tests fail when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 27104
diff changeset
250 set csprg=doesnotexist
0b47ef4e19b8 patch 8.2.5143: some tests fail when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 27104
diff changeset
251 call assert_fails('cscope add Xcscope2.out', 'E262:')
0b47ef4e19b8 patch 8.2.5143: some tests fail when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 27104
diff changeset
252 set csprg=cscope
0b47ef4e19b8 patch 8.2.5143: some tests fail when using valgrind
Bram Moolenaar <Bram@vim.org>
parents: 27104
diff changeset
253 endif
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
254
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
255 " Test: multiple cscope connections
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
256 cscope add Xcscope.out
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
257 cscope add Xcscope2.out . -C
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
258 let a = execute('cscope show')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
259 call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
260 call assert_match('\n 1 \d\+.*Xcscope2.out\s*\.', a)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
261
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
262 " Test: test Ex command line completion
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
263 call feedkeys(":cs \<C-A>\<C-B>\"\<CR>", 'tx')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
264 call assert_equal('"cs add find help kill reset show', @:)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
265
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
266 call feedkeys(":scs \<C-A>\<C-B>\"\<CR>", 'tx')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
267 call assert_equal('"scs find', @:)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
268
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
269 call feedkeys(":cs find \<C-A>\<C-B>\"\<CR>", 'tx')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
270 call assert_equal('"cs find a c d e f g i s t', @:)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
271
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
272 call feedkeys(":cs kill \<C-A>\<C-B>\"\<CR>", 'tx')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
273 call assert_equal('"cs kill -1 0 1', @:)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
274
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
275 call feedkeys(":cs add Xcscope\<C-A>\<C-B>\"\<CR>", 'tx')
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
276 call assert_equal('"cs add Xcscope.out Xcscope2.out', @:)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
277
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
278 " Test: cscope_connection()
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
279 call assert_equal(cscope_connection(), 1)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
280 call assert_equal(cscope_connection(0, 'out'), 1)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
281 call assert_equal(cscope_connection(0, 'xxx'), 1)
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
282
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
283 call assert_equal(cscope_connection(1, 'out'), 1)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
284 call assert_equal(cscope_connection(1, 'xxx'), 0)
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
285
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
286 call assert_equal(cscope_connection(2, 'out'), 0)
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
287 call assert_equal(cscope_connection(2, getcwd() .. '/Xcscope.out', 1), 1)
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
288
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
289 call assert_equal(cscope_connection(3, 'xxx', '..'), 0)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
290 call assert_equal(cscope_connection(3, 'out', 'xxx'), 0)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
291 call assert_equal(cscope_connection(3, 'out', '.'), 1)
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
292
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
293 call assert_equal(cscope_connection(4, 'out', '.'), 0)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
294
19910
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
295 call assert_equal(cscope_connection(5, 'out'), 0)
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
296 call assert_equal(cscope_connection(-1, 'out'), 0)
d9378abde532 patch 8.2.0511: Cscope code not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19249
diff changeset
297
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
298 call CscopeSetupOrClean(0)
14345
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
299 endfunc
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
300
14345
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
301 " Test ":cs add {dir}" (add the {dir}/cscope.out database)
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
302 func Test_cscope_add_dir()
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
303 call mkdir('Xcscopedir', 'p')
14607
73001276abce patch 8.1.0317: Cscope test fails when using shadow directory
Christian Brabandt <cb@256bit.org>
parents: 14345
diff changeset
304
73001276abce patch 8.1.0317: Cscope test fails when using shadow directory
Christian Brabandt <cb@256bit.org>
parents: 14345
diff changeset
305 " Cscope doesn't handle symlinks, so this needs to be resolved in case a
73001276abce patch 8.1.0317: Cscope test fails when using shadow directory
Christian Brabandt <cb@256bit.org>
parents: 14345
diff changeset
306 " shadow directory is being used.
73001276abce patch 8.1.0317: Cscope test fails when using shadow directory
Christian Brabandt <cb@256bit.org>
parents: 14345
diff changeset
307 let memfile = resolve('../memfile_test.c')
73001276abce patch 8.1.0317: Cscope test fails when using shadow directory
Christian Brabandt <cb@256bit.org>
parents: 14345
diff changeset
308 call system('cscope -bk -fXcscopedir/cscope.out ' . memfile)
73001276abce patch 8.1.0317: Cscope test fails when using shadow directory
Christian Brabandt <cb@256bit.org>
parents: 14345
diff changeset
309
14345
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
310 cs add Xcscopedir
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
311 let a = execute('cscope show')
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
312 let lines = split(a, "\n", 1)
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
313 call assert_equal(3, len(lines))
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
314 call assert_equal(' # pid database name prepend path', lines[0])
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
315 call assert_equal('', lines[1])
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
316 call assert_match('^ 0 \d\+.*Xcscopedir/cscope.out\s\+<none>$', lines[2])
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
317
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
318 cs kill -1
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
319 call delete('Xcscopedir/cscope.out')
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
320 call assert_fails('cs add Xcscopedir', 'E563:')
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
321
72afa7268670 patch 8.1.0188: no test for ":cscope add"
Christian Brabandt <cb@256bit.org>
parents: 13950
diff changeset
322 call delete('Xcscopedir', 'd')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
323 endfunc
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
324
9505
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
325 func Test_cscopequickfix()
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
326 set cscopequickfix=s-,g-,d+,c-,t+,e-,f0,i-,a-
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
327 call assert_equal('s-,g-,d+,c-,t+,e-,f0,i-,a-', &cscopequickfix)
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
328
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
329 call assert_fails('set cscopequickfix=x-', 'E474:')
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
330 call assert_fails('set cscopequickfix=s', 'E474:')
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
331 call assert_fails('set cscopequickfix=s7', 'E474:')
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
332 call assert_fails('set cscopequickfix=s-a', 'E474:')
da98db362fef commit https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
333 endfunc
9746
ab96eb561a7e commit https://github.com/vim/vim/commit/edf634e0f1985c5ea1afb5b480b47a44cabbce34
Christian Brabandt <cb@256bit.org>
parents: 9505
diff changeset
334
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
335 func Test_withoutCscopeConnection()
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
336 call assert_equal(cscope_connection(), 0)
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
337
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
338 call assert_fails('cscope find s main', 'E567:')
13950
741b1feeac9f patch 8.0.1845: various comment updates needed, missing white space
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
339 let a = execute('cscope show')
9800
c470694733db commit https://github.com/vim/vim/commit/812ad4f3a2cb33002a24f6b5862c7b375cd68fe4
Christian Brabandt <cb@256bit.org>
parents: 9768
diff changeset
340 call assert_match('no cscope connections', a)
9746
ab96eb561a7e commit https://github.com/vim/vim/commit/edf634e0f1985c5ea1afb5b480b47a44cabbce34
Christian Brabandt <cb@256bit.org>
parents: 9505
diff changeset
341 endfunc
ab96eb561a7e commit https://github.com/vim/vim/commit/edf634e0f1985c5ea1afb5b480b47a44cabbce34
Christian Brabandt <cb@256bit.org>
parents: 9505
diff changeset
342
ab96eb561a7e commit https://github.com/vim/vim/commit/edf634e0f1985c5ea1afb5b480b47a44cabbce34
Christian Brabandt <cb@256bit.org>
parents: 9505
diff changeset
343
ab96eb561a7e commit https://github.com/vim/vim/commit/edf634e0f1985c5ea1afb5b480b47a44cabbce34
Christian Brabandt <cb@256bit.org>
parents: 9505
diff changeset
344 " vim: shiftwidth=2 sts=2 expandtab