summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-03-17 22:07:02 +0100
committerBram Moolenaar <Bram@vim.org>2016-03-17 22:07:02 +0100
commit1ff2b64b11e7d263c6853745d5e594bd8f94b91e (patch)
treefb7062c650a212bae16a041ccd3c02134f0a5969
parent1c8b4edb9b6cd5248925f3f06ec82486be9fb4ea (diff)
patch 7.4.1588v7.4.1588
Problem: Old style test for quickfix. Solution: Turn test 96 into a new style test.
-rw-r--r--src/testdir/Make_all.mak1
-rw-r--r--src/testdir/test96.in142
-rw-r--r--src/testdir/test96.ok9
-rw-r--r--src/testdir/test_quickfix.vim112
-rw-r--r--src/version.c2
5 files changed, 114 insertions, 152 deletions
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 84474d920c..c41da39df6 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -79,7 +79,6 @@ SCRIPTS_ALL = \
test93.out \
test94.out \
test95.out \
- test96.out \
test98.out \
test99.out \
test101.out \
diff --git a/src/testdir/test96.in b/src/testdir/test96.in
deleted file mode 100644
index 9d1a2c83a5..0000000000
--- a/src/testdir/test96.in
+++ /dev/null
@@ -1,142 +0,0 @@
-This will test for problems in quickfix:
-A. incorrectly copying location lists which caused the location list to show a
- different name than the file that was actually being displayed.
-B. not reusing the window for which the location list window is opened but
- instead creating new windows.
-C. make sure that the location list window is not reused instead of the window
- it belongs to.
-
-Note: to debug a problem comment out the last ":b 1" in a test and testing will
-stop at this point.
-
-STARTTEST
-:so small.vim
-: enew
-: w! test.out
-: b 1
-: " Set up the test environment:
-: function! ReadTestProtocol(name)
-: let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '')
-: let word = substitute(base, '\v(.*)\..*', '\1', '')
-:
-: setl modifiable
-: setl noreadonly
-: setl noswapfile
-: setl bufhidden=delete
-: %del _
-: " For problem 2:
-: " 'buftype' has to be set to reproduce the constant opening of new windows
-: setl buftype=nofile
-:
-: call setline(1, word)
-:
-: setl nomodified
-: setl nomodifiable
-: setl readonly
-: exe 'doautocmd BufRead ' . substitute(a:name, '\v^test://(.*)', '\1', '')
-: endfunction
-: augroup testgroup
-: au!
-: autocmd BufReadCmd test://* call ReadTestProtocol(expand("<amatch>"))
-: augroup END
-: let words = [ "foo", "bar", "baz", "quux", "shmoo", "spam", "eggs" ]
-:
-: let qflist = []
-: for word in words
-: call add(qflist, {'filename': 'test://' . word . '.txt', 'text': 'file ' . word . '.txt', })
-: " NOTE: problem 1:
-: " intentionally not setting 'lnum' so that the quickfix entries are not
-: " valid
-: call setloclist(0, qflist, ' ')
-: endfor
-ENDTEST
-
-Test A:
-STARTTEST
-:lrewind
-:enew
-:lopen
-:lnext
-:lnext
-:lnext
-:lnext
-:vert split
-:wincmd L
-:lopen
-:wincmd p
-:lnext
-:"b 1
-:let fileName = expand("%")
-:wincmd p
-:let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')
-:wincmd n
-:wincmd K
-:b test.out
-:let fileName = substitute(fileName, '\\', '/', 'g')
-:let locationListFileName = substitute(locationListFileName, '\\', '/', 'g')
-:call append(line('$'), "Test A:")
-:call append(line('$'), " - file name displayed: " . fileName)
-:call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName)
-:w
-:wincmd o
-:b 1
-ENDTEST
-
-Test B:
-STARTTEST
-:lrewind
-:lopen
-:2
-:exe "normal \<CR>"
-:wincmd p
-:3
-:exe "normal \<CR>"
-:wincmd p
-:4
-:exe "normal \<CR>"
-:let numberOfWindowsOpen = winnr('$')
-:wincmd n
-:wincmd K
-:b test.out
-:call append(line('$'), "Test B:")
-:call append(line('$'), " - number of window open: " . numberOfWindowsOpen)
-:w
-:wincmd o
-:b 1
-ENDTEST
-
-Test C:
-STARTTEST
-:lrewind
-:lopen
-:" Let's move the location list window to the top to check whether it (the first
-:" window found) will be reused when we try to open new windows:
-:wincmd K
-:2
-:exe "normal \<CR>"
-:wincmd p
-:3
-:exe "normal \<CR>"
-:wincmd p
-:4
-:exe "normal \<CR>"
-:1wincmd w
-:let locationListWindowBufType = &buftype
-:2wincmd w
-:let bufferName = expand("%")
-:wincmd n
-:wincmd K
-:b test.out
-:let bufferName = substitute(bufferName, '\\', '/', 'g')
-:call append(line('$'), "Test C:")
-:call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType)
-:call append(line('$'), " - buffer displayed in the 2nd window: " . bufferName)
-:w
-:wincmd o
-:b 1
-ENDTEST
-
-STARTTEST
-:qa
-ENDTEST
-
diff --git a/src/testdir/test96.ok b/src/testdir/test96.ok
deleted file mode 100644
index 3498e52f73..0000000000
--- a/src/testdir/test96.ok
+++ /dev/null
@@ -1,9 +0,0 @@
-
-Test A:
- - file name displayed: test://bar.txt
- - quickfix claims that the file name displayed is: test://bar.txt
-Test B:
- - number of window open: 2
-Test C:
- - 'buftype' of the location list window: quickfix
- - buffer displayed in the 2nd window: test://quux.txt
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index 4be37d5860..d551febdf5 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -366,3 +366,115 @@ function Test_efm()
call assert_equal("[['W', 1], ['ZZZZ', 0], ['E^@CCCC', 1], ['YYYY', 0]]", l)
let &efm = save_efm
endfunction
+
+" This will test for problems in quickfix:
+" A. incorrectly copying location lists which caused the location list to show
+" a different name than the file that was actually being displayed.
+" B. not reusing the window for which the location list window is opened but
+" instead creating new windows.
+" C. make sure that the location list window is not reused instead of the
+" window it belongs to.
+"
+" Set up the test environment:
+function! ReadTestProtocol(name)
+ let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '')
+ let word = substitute(base, '\v(.*)\..*', '\1', '')
+
+ setl modifiable
+ setl noreadonly
+ setl noswapfile
+ setl bufhidden=delete
+ %del _
+ " For problem 2:
+ " 'buftype' has to be set to reproduce the constant opening of new windows
+ setl buftype=nofile
+
+ call setline(1, word)
+
+ setl nomodified
+ setl nomodifiable
+ setl readonly
+ exe 'doautocmd BufRead ' . substitute(a:name, '\v^test://(.*)', '\1', '')
+endfunction
+
+function Test_locationlist()
+ enew
+
+ augroup testgroup
+ au!
+ autocmd BufReadCmd test://* call ReadTestProtocol(expand("<amatch>"))
+ augroup END
+
+ let words = [ "foo", "bar", "baz", "quux", "shmoo", "spam", "eggs" ]
+
+ let qflist = []
+ for word in words
+ call add(qflist, {'filename': 'test://' . word . '.txt', 'text': 'file ' . word . '.txt', })
+ " NOTE: problem 1:
+ " intentionally not setting 'lnum' so that the quickfix entries are not
+ " valid
+ call setloclist(0, qflist, ' ')
+ endfor
+
+ " Test A
+ lrewind
+ enew
+ lopen
+ lnext
+ lnext
+ lnext
+ lnext
+ vert split
+ wincmd L
+ lopen
+ wincmd p
+ lnext
+ let fileName = expand("%")
+ wincmd p
+ let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')
+ let fileName = substitute(fileName, '\\', '/', 'g')
+ let locationListFileName = substitute(locationListFileName, '\\', '/', 'g')
+ call assert_equal("test://bar.txt", fileName)
+ call assert_equal("test://bar.txt", locationListFileName)
+
+ wincmd n | only
+
+ " Test B:
+ lrewind
+ lopen
+ 2
+ exe "normal \<CR>"
+ wincmd p
+ 3
+ exe "normal \<CR>"
+ wincmd p
+ 4
+ exe "normal \<CR>"
+ call assert_equal(2, winnr('$'))
+ wincmd n | only
+
+ " Test C:
+ lrewind
+ lopen
+ " Let's move the location list window to the top to check whether it (the
+ " first window found) will be reused when we try to open new windows:
+ wincmd K
+ 2
+ exe "normal \<CR>"
+ wincmd p
+ 3
+ exe "normal \<CR>"
+ wincmd p
+ 4
+ exe "normal \<CR>"
+ 1wincmd w
+ call assert_equal('quickfix', &buftype)
+ 2wincmd w
+ let bufferName = expand("%")
+ let bufferName = substitute(bufferName, '\\', '/', 'g')
+ call assert_equal('test://quux.txt', bufferName)
+
+ wincmd n | only
+
+ augroup! testgroup
+endfunction
diff --git a/src/version.c b/src/version.c
index 6e58e85e40..405c9d689d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1588,
+/**/
1587,
/**/
1586,