annotate src/testdir/test_buffer.vim @ 29997:98f5a0618a77 v9.0.0336

patch 9.0.0336: tests are flaky because of using a common file name Commit: https://github.com/vim/vim/commit/61abe7d8f827ec31f098e8abcdf58846b956ef16 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 30 21:46:08 2022 +0100 patch 9.0.0336: tests are flaky because of using a common file name Problem: Tests are flaky because of using a common file name. Solution: Rename files and directories to be more unique.
author Bram Moolenaar <Bram@vim.org>
date Tue, 30 Aug 2022 23:00:05 +0200
parents c8b1a683323c
children ba5ca7c7d44c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for Vim buffer
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
3 source check.vim
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
4
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Test for the :bunload command with an offset
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 func Test_bunload_with_offset()
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 %bwipe!
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 call writefile(['B1'], 'b1')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 call writefile(['B2'], 'b2')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 call writefile(['B3'], 'b3')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 call writefile(['B4'], 'b4')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 " Load four buffers. Unload the second and third buffers and then
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 " execute .+3bunload to unload the last buffer.
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 edit b1
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 new b2
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 new b3
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 new b4
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 bunload b2
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 bunload b3
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 exe bufwinnr('b1') . 'wincmd w'
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 .+3bunload
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 call assert_equal(0, getbufinfo('b4')[0].loaded)
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 call assert_equal('b1',
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 \ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 " Load four buffers. Unload the third and fourth buffers. Execute .+3bunload
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 " and check whether the second buffer is unloaded.
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 ball
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 bunload b3
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 bunload b4
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 exe bufwinnr('b1') . 'wincmd w'
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 .+3bunload
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 call assert_equal(0, getbufinfo('b2')[0].loaded)
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 call assert_equal('b1',
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 \ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 " Load four buffers. Unload the second and third buffers and from the last
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 " buffer execute .-3bunload to unload the first buffer.
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 ball
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 bunload b2
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 bunload b3
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 exe bufwinnr('b4') . 'wincmd w'
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 .-3bunload
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 call assert_equal(0, getbufinfo('b1')[0].loaded)
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 call assert_equal('b4',
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 \ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 " Load four buffers. Unload the first and second buffers. Execute .-3bunload
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 " from the last buffer and check whether the third buffer is unloaded.
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 ball
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 bunload b1
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 bunload b2
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 exe bufwinnr('b4') . 'wincmd w'
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 .-3bunload
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 call assert_equal(0, getbufinfo('b3')[0].loaded)
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 call assert_equal('b4',
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 \ fnamemodify(getbufinfo({'bufloaded' : 1})[0].name, ':t'))
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 %bwipe!
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 call delete('b1')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 call delete('b2')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 call delete('b3')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 call delete('b4')
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
66
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
67 call assert_fails('1,4bunload', 'E16:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
68 call assert_fails(',100bunload', 'E16:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
69
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20990
diff changeset
70 call assert_fails('$bunload', 'E90:')
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
71 endfunc
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
72
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
73 " Test for :buffer, :bnext, :bprevious, :brewind, :blast and :bmodified
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
74 " commands
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
75 func Test_buflist_browse()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
76 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
77 call assert_fails('buffer 1000', 'E86:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
78
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
79 call writefile(['foo1', 'foo2', 'foo3', 'foo4'], 'Xbrowse1')
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
80 call writefile(['bar1', 'bar2', 'bar3', 'bar4'], 'Xbrowse2')
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
81 call writefile(['baz1', 'baz2', 'baz3', 'baz4'], 'Xbrowse3')
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
82 edit Xbrowse1
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
83 let b1 = bufnr()
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
84 edit Xbrowse2
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
85 let b2 = bufnr()
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
86 edit +/baz4 Xbrowse3
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
87 let b3 = bufnr()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
88
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
89 call assert_fails('buffer ' .. b1 .. ' abc', 'E488:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
90 call assert_equal(b3, bufnr())
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
91 call assert_equal(4, line('.'))
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
92 exe 'buffer +/bar2 ' .. b2
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
93 call assert_equal(b2, bufnr())
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
94 call assert_equal(2, line('.'))
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
95 exe 'buffer +/bar1'
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
96 call assert_equal(b2, bufnr())
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
97 call assert_equal(1, line('.'))
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
98
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
99 brewind +
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
100 call assert_equal(b1, bufnr())
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
101 call assert_equal(4, line('.'))
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
102
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
103 blast +/baz2
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
104 call assert_equal(b3, bufnr())
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
105 call assert_equal(2, line('.'))
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
106
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
107 bprevious +/bar4
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
108 call assert_equal(b2, bufnr())
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
109 call assert_equal(4, line('.'))
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
110
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
111 bnext +/baz3
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
112 call assert_equal(b3, bufnr())
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
113 call assert_equal(3, line('.'))
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
114
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
115 call assert_fails('bmodified', 'E84:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
116 call setbufvar(b2, '&modified', 1)
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
117 exe 'bmodified +/bar3'
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
118 call assert_equal(b2, bufnr())
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
119 call assert_equal(3, line('.'))
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
120
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
121 " With no listed buffers in the list, :bnext and :bprev should fail
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
122 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
123 set nobuflisted
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
124 call assert_fails('bnext', 'E85:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
125 call assert_fails('bprev', 'E85:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
126 set buflisted
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
127
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
128 call assert_fails('sandbox bnext', 'E48:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
129
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
130 call delete('Xbrowse1')
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
131 call delete('Xbrowse2')
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
132 call delete('Xbrowse3')
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
133 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
134 endfunc
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
135
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
136 " Test for :bdelete
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
137 func Test_bdelete_cmd()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
138 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
139 call assert_fails('bdelete 5', 'E516:')
19740
a653d1a165ef patch 8.2.0426: some errors were not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
140 call assert_fails('1,1bdelete 1 2', 'E488:')
22375
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21419
diff changeset
141 call assert_fails('bdelete \)', 'E55:')
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
142
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
143 " Deleting a unlisted and unloaded buffer
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29950
diff changeset
144 edit Xbdelfile1
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
145 let bnr = bufnr()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
146 set nobuflisted
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
147 enew
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
148 call assert_fails('bdelete ' .. bnr, 'E516:')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
149
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
150 " Deleting more than one buffer
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
151 new Xbuf1
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
152 new Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
153 exe 'bdel ' .. bufnr('Xbuf2') .. ' ' .. bufnr('Xbuf1')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
154 call assert_equal(1, winnr('$'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
155 call assert_equal(0, getbufinfo('Xbuf1')[0].loaded)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
156 call assert_equal(0, getbufinfo('Xbuf2')[0].loaded)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
157
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
158 " Deleting more than one buffer and an invalid buffer
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
159 new Xbuf1
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
160 new Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
161 let cmd = "exe 'bdel ' .. bufnr('Xbuf2') .. ' xxx ' .. bufnr('Xbuf1')"
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
162 call assert_fails(cmd, 'E94:')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
163 call assert_equal(2, winnr('$'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
164 call assert_equal(1, getbufinfo('Xbuf1')[0].loaded)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
165 call assert_equal(0, getbufinfo('Xbuf2')[0].loaded)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
166
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
167 %bwipe!
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169
20041
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
170 func Test_buffer_error()
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
171 new foo1
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
172 new foo2
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
173
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
174 call assert_fails('buffer foo', 'E93:')
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
175 call assert_fails('buffer bar', 'E94:')
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
176 call assert_fails('buffer 0', 'E939:')
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
177
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
178 %bwipe
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
179 endfunc
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
180
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
181 " Test for the status messages displayed when unloading, deleting or wiping
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
182 " out buffers
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
183 func Test_buffer_statusmsg()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
184 CheckEnglish
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
185 set report=1
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
186 new Xbuf1
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
187 new Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
188 let bnr = bufnr()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
189 exe "normal 2\<C-G>"
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
190 call assert_match('buf ' .. bnr .. ':', v:statusmsg)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
191 bunload Xbuf1 Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
192 call assert_equal('2 buffers unloaded', v:statusmsg)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
193 bdel Xbuf1 Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
194 call assert_equal('2 buffers deleted', v:statusmsg)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
195 bwipe Xbuf1 Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
196 call assert_equal('2 buffers wiped out', v:statusmsg)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
197 set report&
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
198 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
199
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
200 " Test for quitting the 'swapfile exists' dialog with the split buffer
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
201 " command.
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
202 func Test_buffer_sbuf_cleanup()
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
203 call writefile([], 'XsplitCleanup')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
204 " first open the file in a buffer
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
205 new XsplitCleanup
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
206 let bnr = bufnr()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
207 close
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
208 " create the swap file
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
209 call writefile([], '.XsplitCleanup.swp')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
210 " Remove the catch-all that runtest.vim adds
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
211 au! SwapExists
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
212 augroup BufTest
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
213 au!
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
214 autocmd SwapExists XsplitCleanup let v:swapchoice='q'
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
215 augroup END
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
216 exe 'sbuf ' . bnr
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
217 call assert_equal(1, winnr('$'))
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
218 call assert_equal(0, getbufinfo('XsplitCleanup')[0].loaded)
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
219
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
220 " test for :sball
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
221 sball
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
222 call assert_equal(1, winnr('$'))
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
223 call assert_equal(0, getbufinfo('XsplitCleanup')[0].loaded)
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
224
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
225 %bw!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
226 set shortmess+=F
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
227 let v:statusmsg = ''
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
228 edit XsplitCleanup
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
229 call assert_equal('', v:statusmsg)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
230 call assert_equal(1, winnr('$'))
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
231 call assert_equal(0, getbufinfo('XsplitCleanup')[0].loaded)
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
232 set shortmess&
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
233
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
234 call delete('XsplitCleanup')
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
235 call delete('.XsplitCleanup.swp')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
236 augroup BufTest
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
237 au!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
238 augroup END
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
239 augroup! BufTest
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
240 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
241
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
242 " Test for deleting a modified buffer with :confirm
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
243 func Test_bdel_with_confirm()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
244 CheckUnix
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
245 CheckNotGui
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
246 CheckFeature dialog_con
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
247 new
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
248 call setline(1, 'test')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
249 call assert_fails('bdel', 'E89:')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
250 call feedkeys('c', 'L')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
251 confirm bdel
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
252 call assert_equal(2, winnr('$'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
253 call assert_equal(1, &modified)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
254 call feedkeys('n', 'L')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
255 confirm bdel
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
256 call assert_equal(1, winnr('$'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
257 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
258
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
259 " Test for editing another buffer from a modified buffer with :confirm
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
260 func Test_goto_buf_with_confirm()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
261 CheckUnix
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
262 CheckNotGui
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
263 CheckFeature dialog_con
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
264 new XgotoConf
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
265 enew
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
266 call setline(1, 'test')
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
267 call assert_fails('b XgotoConf', 'E37:')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
268 call feedkeys('c', 'L')
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
269 call assert_fails('confirm b XgotoConf', 'E37:')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
270 call assert_equal(1, &modified)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
271 call assert_equal('', @%)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
272 call feedkeys('y', 'L')
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
273 call assert_fails('confirm b XgotoConf', ['', 'E37:'])
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
274 call assert_equal(1, &modified)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
275 call assert_equal('', @%)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
276 call feedkeys('n', 'L')
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
277 confirm b XgotoConf
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
278 call assert_equal('XgotoConf', @%)
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
279 close!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
280 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
281
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
282 " Test for splitting buffer with 'switchbuf'
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
283 func Test_buffer_switchbuf()
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
284 new Xswitchbuf
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
285 wincmd w
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
286 set switchbuf=useopen
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
287 sbuf Xswitchbuf
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
288 call assert_equal(1, winnr())
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
289 call assert_equal(2, winnr('$'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
290 set switchbuf=usetab
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
291 tabnew
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
292 sbuf Xswitchbuf
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
293 call assert_equal(1, tabpagenr())
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
294 call assert_equal(2, tabpagenr('$'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
295 set switchbuf&
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
296 %bw
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
297 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
298
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
299 " Test for BufAdd autocommand wiping out the buffer
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
300 func Test_bufadd_autocmd_bwipe()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
301 %bw!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
302 augroup BufAdd_Wipe
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
303 au!
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
304 autocmd BufAdd Xbwipe %bw!
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
305 augroup END
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
306 edit Xbwipe
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
307 call assert_equal('', @%)
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
308 call assert_equal(0, bufexists('Xbwipe'))
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
309 augroup BufAdd_Wipe
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
310 au!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
311 augroup END
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
312 augroup! BufAdd_Wipe
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
313 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
314
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
315 " Test for trying to load a buffer with text locked
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
316 " <C-\>e in the command line is used to lock the text
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
317 func Test_load_buf_with_text_locked()
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29950
diff changeset
318 new Xlockfile1
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29950
diff changeset
319 edit Xlockfile2
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
320 let cmd = ":\<C-\>eexecute(\"normal \<C-O>\")\<CR>\<C-C>"
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
321 call assert_fails("call feedkeys(cmd, 'xt')", 'E565:')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
322 %bw!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
323 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
324
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
325 " Test for using CTRL-^ to edit the alternative file keeping the cursor
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
326 " position with 'nostartofline'. Also test using the 'buf' command.
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
327 func Test_buffer_edit_altfile()
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
328 call writefile(repeat(['one two'], 50), 'Xaltfile1')
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
329 call writefile(repeat(['five six'], 50), 'Xaltfile2')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
330 set nosol
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
331 edit Xaltfile1
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
332 call cursor(25, 5)
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
333 edit Xaltfile2
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
334 call cursor(30, 4)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
335 exe "normal \<C-^>"
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
336 call assert_equal([0, 25, 5, 0], getpos('.'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
337 exe "normal \<C-^>"
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
338 call assert_equal([0, 30, 4, 0], getpos('.'))
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
339 buf Xaltfile1
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
340 call assert_equal([0, 25, 5, 0], getpos('.'))
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
341 buf Xaltfile2
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
342 call assert_equal([0, 30, 4, 0], getpos('.'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
343 set sol&
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
344 call delete('Xaltfile1')
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
345 call delete('Xaltfile2')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
346 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
347
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
348 " Test for running the :sball command with a maximum window count and a
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
349 " modified buffer
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
350 func Test_sball_with_count()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
351 %bw!
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
352 edit Xcountfile1
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
353 call setline(1, ['abc'])
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
354 new Xcountfile2
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
355 new Xcountfile3
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
356 new Xcountfile4
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
357 2sball
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
358 call assert_equal(bufnr('Xcountfile4'), winbufnr(1))
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
359 call assert_equal(bufnr('Xcountfile1'), winbufnr(2))
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
360 call assert_equal(0, getbufinfo('Xcountfile2')[0].loaded)
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
361 call assert_equal(0, getbufinfo('Xcountfile3')[0].loaded)
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
362 %bw!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
363 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
364
22707
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
365 func Test_badd_options()
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
366 new SomeNewBuffer
22709
ecf0a8d6d4df patch 8.2.1903: buffer test fails with normal features
Bram Moolenaar <Bram@vim.org>
parents: 22707
diff changeset
367 setlocal numberwidth=3
22707
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
368 wincmd p
22711
92f221ad267c patch 8.2.1904: still using default option values after using ":badd +1"
Bram Moolenaar <Bram@vim.org>
parents: 22709
diff changeset
369 badd +1 SomeNewBuffer
22707
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
370 new SomeNewBuffer
22709
ecf0a8d6d4df patch 8.2.1903: buffer test fails with normal features
Bram Moolenaar <Bram@vim.org>
parents: 22707
diff changeset
371 call assert_equal(3, &numberwidth)
22707
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
372 close
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
373 close
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
374 bwipe! SomeNewBuffer
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
375 endfunc
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
376
22840
7c1e2e3f2d8d patch 8.2.1967: the session file does not restore the alternate file
Bram Moolenaar <Bram@vim.org>
parents: 22711
diff changeset
377 func Test_balt()
7c1e2e3f2d8d patch 8.2.1967: the session file does not restore the alternate file
Bram Moolenaar <Bram@vim.org>
parents: 22711
diff changeset
378 new SomeNewBuffer
7c1e2e3f2d8d patch 8.2.1967: the session file does not restore the alternate file
Bram Moolenaar <Bram@vim.org>
parents: 22711
diff changeset
379 balt +3 OtherBuffer
7c1e2e3f2d8d patch 8.2.1967: the session file does not restore the alternate file
Bram Moolenaar <Bram@vim.org>
parents: 22711
diff changeset
380 e #
7c1e2e3f2d8d patch 8.2.1967: the session file does not restore the alternate file
Bram Moolenaar <Bram@vim.org>
parents: 22711
diff changeset
381 call assert_equal('OtherBuffer', bufname())
7c1e2e3f2d8d patch 8.2.1967: the session file does not restore the alternate file
Bram Moolenaar <Bram@vim.org>
parents: 22711
diff changeset
382 endfunc
7c1e2e3f2d8d patch 8.2.1967: the session file does not restore the alternate file
Bram Moolenaar <Bram@vim.org>
parents: 22711
diff changeset
383
25234
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
384 " Test for buffer match URL(scheme) check
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
385 " scheme is alpha and inner hyphen only.
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
386 func Test_buffer_scheme()
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
387 CheckMSWindows
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
388
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
389 set noshellslash
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
390 %bwipe!
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
391 let bufnames = [
26376
856b56468157 patch 8.2.3719: MS-Windows: test sometimes runs into existing swap file
Bram Moolenaar <Bram@vim.org>
parents: 25234
diff changeset
392 \ #{id: 'ssb0', name: 'test://xyz/foo/ssb0' , match: 1},
856b56468157 patch 8.2.3719: MS-Windows: test sometimes runs into existing swap file
Bram Moolenaar <Bram@vim.org>
parents: 25234
diff changeset
393 \ #{id: 'ssb1', name: 'test+abc://xyz/foo/ssb1', match: 0},
856b56468157 patch 8.2.3719: MS-Windows: test sometimes runs into existing swap file
Bram Moolenaar <Bram@vim.org>
parents: 25234
diff changeset
394 \ #{id: 'ssb2', name: 'test_abc://xyz/foo/ssb2', match: 0},
856b56468157 patch 8.2.3719: MS-Windows: test sometimes runs into existing swap file
Bram Moolenaar <Bram@vim.org>
parents: 25234
diff changeset
395 \ #{id: 'ssb3', name: 'test-abc://xyz/foo/ssb3', match: 1},
856b56468157 patch 8.2.3719: MS-Windows: test sometimes runs into existing swap file
Bram Moolenaar <Bram@vim.org>
parents: 25234
diff changeset
396 \ #{id: 'ssb4', name: '-test://xyz/foo/ssb4' , match: 0},
856b56468157 patch 8.2.3719: MS-Windows: test sometimes runs into existing swap file
Bram Moolenaar <Bram@vim.org>
parents: 25234
diff changeset
397 \ #{id: 'ssb5', name: 'test-://xyz/foo/ssb5' , match: 0},
25234
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
398 \]
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
399 for buf in bufnames
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
400 new `=buf.name`
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
401 if buf.match
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
402 call assert_equal(buf.name, getbufinfo(buf.id)[0].name)
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
403 else
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
404 " slashes will have become backslashes
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
405 call assert_notequal(buf.name, getbufinfo(buf.id)[0].name)
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
406 endif
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
407 bwipe
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
408 endfor
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
409
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
410 set shellslash&
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
411 endfunc
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
412
28753
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
413 " this was using a NULL pointer after failing to use the pattern
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
414 func Test_buf_pattern_invalid()
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
415 vsplit 0000000
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
416 silent! buf [0--]\&\zs*\zs*e
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
417 bwipe!
28829
2d0bd5601c30 patch 8.2.4938: crash when matching buffer with invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28753
diff changeset
418
2d0bd5601c30 patch 8.2.4938: crash when matching buffer with invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28753
diff changeset
419 vsplit 00000000000000000000000000
2d0bd5601c30 patch 8.2.4938: crash when matching buffer with invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28753
diff changeset
420 silent! buf [0--]\&\zs*\zs*e
2d0bd5601c30 patch 8.2.4938: crash when matching buffer with invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28753
diff changeset
421 bwipe!
28873
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
422
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
423 " similar case with different code path
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
424 split 0
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
425 edit ÿ
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
426 silent! buf [0--]\&\zs*\zs*0
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
427 bwipe!
28753
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
428 endfunc
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
429
24669
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
430 " Test for the 'maxmem' and 'maxmemtot' options
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
431 func Test_buffer_maxmem()
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
432 " use 1KB per buffer and 2KB for all the buffers
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
433 set maxmem=1 maxmemtot=2
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
434 new
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
435 let v:errmsg = ''
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
436 " try opening some files
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
437 edit test_arglist.vim
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
438 call assert_equal('test_arglist.vim', bufname())
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
439 edit test_eval_stuff.vim
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
440 call assert_equal('test_eval_stuff.vim', bufname())
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
441 b test_arglist.vim
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
442 call assert_equal('test_arglist.vim', bufname())
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
443 b test_eval_stuff.vim
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
444 call assert_equal('test_eval_stuff.vim', bufname())
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
445 close
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
446 call assert_equal('', v:errmsg)
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
447 set maxmem& maxmemtot&
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
448 endfunc
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
449
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
450 " Test for buffer allocation failure
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
451 func Test_buflist_alloc_failure()
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
452 %bw!
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
453
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
454 edit XallocFail1
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
455 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
456 call assert_fails('edit XallocFail2', 'E342:')
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
457
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
458 " test for bufadd()
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
459 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
460 call assert_fails('call bufadd("Xbuffer")', 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
461
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
462 " test for setting the arglist
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
463 edit XallocFail2
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
464 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
465 call assert_fails('next XallocFail3', 'E342:')
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
466
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
467 " test for setting the alternate buffer name when writing a file
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
468 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
469 call assert_fails('write Xother', 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
470 call delete('Xother')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
471
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
472 " test for creating a buffer using bufnr()
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
473 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
474 call assert_fails("call bufnr('Xnewbuf', v:true)", 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
475
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
476 " test for renaming buffer using :file
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
477 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
478 call assert_fails('file Xnewfile', 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
479
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
480 " test for creating a buffer for a popup window
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
481 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
482 call assert_fails('call popup_create("mypop", {})', 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
483
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
484 if has('terminal')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
485 " test for creating a buffer for a terminal window
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
486 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
487 call assert_fails('call term_start(&shell)', 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
488 %bw!
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
489 endif
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
490
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
491 " test for loading a new buffer after wiping out all the buffers
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
492 edit XallocFail4
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
493 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
494 call assert_fails('%bw!', 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
495
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
496 " test for :checktime loading the buffer
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
497 call writefile(['one'], 'XallocFail5')
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
498 if has('unix')
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
499 edit XallocFail5
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
500 " sleep for some time to make sure the timestamp is different
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
501 sleep 200m
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
502 call writefile(['two'], 'XallocFail5')
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
503 set autoread
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
504 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
505 call assert_fails('checktime', 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
506 set autoread&
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
507 bw!
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
508 endif
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
509
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
510 " test for :vimgrep loading a dummy buffer
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
511 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
512 call assert_fails('vimgrep two XallocFail5', 'E342:')
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
513 call delete('XallocFail5')
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
514
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
515 " test for quickfix command loading a buffer
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
516 call test_alloc_fail(GetAllocId('newbuf_bvars'), 0, 0)
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
517 call assert_fails('cexpr "XallocFail6:10:Line10"', 'E342:')
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
518 endfunc
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
519
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
520 " vim: shiftwidth=2 sts=2 expandtab