Mercurial > vim
annotate src/testdir/test96.in @ 8364:991d8fd4d841 v7.4.1474
commit https://github.com/vim/vim/commit/5fac467474376a844407cecc0ff481510ead221c
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 2 22:16:32 2016 +0100
patch 7.4.1474
Problem: Compiler warnings without the float feature.
Solution: Move #ifdefs. (John Marriott)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 02 Mar 2016 22:30:05 +0100 |
parents | 6cabac58f26f |
children |
rev | line source |
---|---|
5084 | 1 This will test for problems in quickfix: |
2 A. incorrectly copying location lists which caused the location list to show a | |
3 different name than the file that was actually being displayed. | |
4 B. not reusing the window for which the location list window is opened but | |
5 instead creating new windows. | |
6 C. make sure that the location list window is not reused instead of the window | |
7 it belongs to. | |
8 | |
9 Note: to debug a problem comment out the last ":b 1" in a test and testing will | |
10 stop at this point. | |
11 | |
12 STARTTEST | |
13 :so small.vim | |
14 : enew | |
15 : w! test.out | |
16 : b 1 | |
17 : " Set up the test environment: | |
18 : function! ReadTestProtocol(name) | |
19 : let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '') | |
20 : let word = substitute(base, '\v(.*)\..*', '\1', '') | |
21 : | |
22 : setl modifiable | |
23 : setl noreadonly | |
24 : setl noswapfile | |
25 : setl bufhidden=delete | |
26 : %del _ | |
27 : " For problem 2: | |
28 : " 'buftype' has to be set to reproduce the constant opening of new windows | |
29 : setl buftype=nofile | |
30 : | |
31 : call setline(1, word) | |
32 : | |
33 : setl nomodified | |
34 : setl nomodifiable | |
35 : setl readonly | |
36 : exe 'doautocmd BufRead ' . substitute(a:name, '\v^test://(.*)', '\1', '') | |
37 : endfunction | |
38 : augroup testgroup | |
39 : au! | |
40 : autocmd BufReadCmd test://* call ReadTestProtocol(expand("<amatch>")) | |
41 : augroup END | |
42 : let words = [ "foo", "bar", "baz", "quux", "shmoo", "spam", "eggs" ] | |
43 : | |
44 : let qflist = [] | |
45 : for word in words | |
46 : call add(qflist, {'filename': 'test://' . word . '.txt', 'text': 'file ' . word . '.txt', }) | |
47 : " NOTE: problem 1: | |
48 : " intentionally not setting 'lnum' so that the quickfix entries are not | |
49 : " valid | |
50 : call setloclist(0, qflist, ' ') | |
51 : endfor | |
52 ENDTEST | |
53 | |
54 Test A: | |
55 STARTTEST | |
56 :lrewind | |
57 :enew | |
58 :lopen | |
59 :lnext | |
60 :lnext | |
61 :lnext | |
62 :lnext | |
63 :vert split | |
64 :wincmd L | |
65 :lopen | |
66 :wincmd p | |
67 :lnext | |
68 :"b 1 | |
69 :let fileName = expand("%") | |
70 :wincmd p | |
71 :let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '') | |
72 :wincmd n | |
73 :wincmd K | |
74 :b test.out | |
5116
6cabac58f26f
updated for version 7.3.1301
Bram Moolenaar <bram@vim.org>
parents:
5084
diff
changeset
|
75 :let fileName = substitute(fileName, '\\', '/', 'g') |
6cabac58f26f
updated for version 7.3.1301
Bram Moolenaar <bram@vim.org>
parents:
5084
diff
changeset
|
76 :let locationListFileName = substitute(locationListFileName, '\\', '/', 'g') |
5084 | 77 :call append(line('$'), "Test A:") |
78 :call append(line('$'), " - file name displayed: " . fileName) | |
79 :call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName) | |
80 :w | |
81 :wincmd o | |
82 :b 1 | |
83 ENDTEST | |
84 | |
85 Test B: | |
86 STARTTEST | |
87 :lrewind | |
88 :lopen | |
89 :2 | |
90 :exe "normal \<CR>" | |
91 :wincmd p | |
92 :3 | |
93 :exe "normal \<CR>" | |
94 :wincmd p | |
95 :4 | |
96 :exe "normal \<CR>" | |
97 :let numberOfWindowsOpen = winnr('$') | |
98 :wincmd n | |
99 :wincmd K | |
100 :b test.out | |
101 :call append(line('$'), "Test B:") | |
102 :call append(line('$'), " - number of window open: " . numberOfWindowsOpen) | |
103 :w | |
104 :wincmd o | |
105 :b 1 | |
106 ENDTEST | |
107 | |
108 Test C: | |
109 STARTTEST | |
110 :lrewind | |
111 :lopen | |
112 :" Let's move the location list window to the top to check whether it (the first | |
113 :" window found) will be reused when we try to open new windows: | |
114 :wincmd K | |
115 :2 | |
116 :exe "normal \<CR>" | |
117 :wincmd p | |
118 :3 | |
119 :exe "normal \<CR>" | |
120 :wincmd p | |
121 :4 | |
122 :exe "normal \<CR>" | |
123 :1wincmd w | |
124 :let locationListWindowBufType = &buftype | |
125 :2wincmd w | |
126 :let bufferName = expand("%") | |
127 :wincmd n | |
128 :wincmd K | |
129 :b test.out | |
5116
6cabac58f26f
updated for version 7.3.1301
Bram Moolenaar <bram@vim.org>
parents:
5084
diff
changeset
|
130 :let bufferName = substitute(bufferName, '\\', '/', 'g') |
5084 | 131 :call append(line('$'), "Test C:") |
132 :call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType) | |
133 :call append(line('$'), " - buffer displayed in the 2nd window: " . bufferName) | |
134 :w | |
135 :wincmd o | |
136 :b 1 | |
137 ENDTEST | |
138 | |
139 STARTTEST | |
140 :qa | |
141 ENDTEST | |
142 |