annotate src/testdir/test_buffer.vim @ 35169:2cb134adb079 default tip

Added tag v9.1.0410 for changeset 4aad918ac11315de18ddc191fd8aa7e933b843f1
author Christian Brabandt <cb@256bit.org>
date Sun, 12 May 2024 09:15:06 +0200
parents 54890be01c00
children
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!
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
8 call writefile(['B1'], 'Xb1', 'D')
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
9 call writefile(['B2'], 'Xb2', 'D')
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
10 call writefile(['B3'], 'Xb3', 'D')
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
11 call writefile(['B4'], 'Xb4', 'D')
19370
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.
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
15 edit Xb1
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
16 new Xb2
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
17 new Xb3
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
18 new Xb4
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
20 bunload Xb2
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
21 bunload Xb3
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
22 exe bufwinnr('Xb1') . 'wincmd w'
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 .+3bunload
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
24 call assert_equal(0, getbufinfo('Xb4')[0].loaded)
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
25 call assert_equal('Xb1',
19370
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
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
31 bunload Xb3
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
32 bunload Xb4
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
33 exe bufwinnr('Xb1') . 'wincmd w'
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 .+3bunload
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
35 call assert_equal(0, getbufinfo('Xb2')[0].loaded)
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
36 call assert_equal('Xb1',
19370
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
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
42 bunload Xb2
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
43 bunload Xb3
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
44 exe bufwinnr('Xb4') . 'wincmd w'
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 .-3bunload
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
46 call assert_equal(0, getbufinfo('Xb1')[0].loaded)
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
47 call assert_equal('Xb4',
19370
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
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
53 bunload Xb1
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
54 bunload Xb2
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
55 exe bufwinnr('Xb4') . 'wincmd w'
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 .-3bunload
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
57 call assert_equal(0, getbufinfo('Xb3')[0].loaded)
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
58 call assert_equal('Xb4',
19370
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!
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
62
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
63 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
64 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
65
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20990
diff changeset
66 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
67 endfunc
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
68
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
69 " 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
70 " commands
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
71 func Test_buflist_browse()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
72 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
73 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
74
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
75 call writefile(['foo1', 'foo2', 'foo3', 'foo4'], 'Xbrowse1', 'D')
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
76 call writefile(['bar1', 'bar2', 'bar3', 'bar4'], 'Xbrowse2', 'D')
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
77 call writefile(['baz1', 'baz2', 'baz3', 'baz4'], 'Xbrowse3', 'D')
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
78 edit Xbrowse1
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
79 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
80 edit Xbrowse2
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
81 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
82 edit +/baz4 Xbrowse3
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
83 let b3 = bufnr()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
84
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
85 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
86 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
87 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
88 exe 'buffer +/bar2 ' .. b2
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
89 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
90 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
91 exe 'buffer +/bar1'
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
92 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
93 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
94
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
95 brewind +
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
96 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
97 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
98
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
99 blast +/baz2
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
100 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
101 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
102
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
103 bprevious +/bar4
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
104 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
105 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
106
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
107 bnext +/baz3
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
108 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
109 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
110
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
111 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
112 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
113 exe 'bmodified +/bar3'
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
114 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
115 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
116
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
117 " 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
118 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
119 set nobuflisted
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
120 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
121 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
122 set buflisted
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
123
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
124 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
125
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
126 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
127 endfunc
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
128
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
129 " Test for :bdelete
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
130 func Test_bdelete_cmd()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
131 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
132 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
133 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
134 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
135
34678
75f7b311ee25 patch 9.1.0220: Few typos in source and test files
Christian Brabandt <cb@256bit.org>
parents: 30341
diff changeset
136 " Deleting an 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
137 edit Xbdelfile1
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
138 let bnr = bufnr()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
139 set nobuflisted
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
140 enew
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
141 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
142
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
143 " 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
144 new Xbuf1
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
145 new Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
146 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
147 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
148 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
149 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
150
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
151 " 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
152 new Xbuf1
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
153 new Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
154 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
155 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
156 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
157 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
158 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
159
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
160 %bwipe!
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162
20041
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
163 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
164 new foo1
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
165 new foo2
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
166
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
167 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
168 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
169 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
170
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
171 %bwipe
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
172 endfunc
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19740
diff changeset
173
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
174 " 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
175 " out buffers
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
176 func Test_buffer_statusmsg()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
177 CheckEnglish
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
178 set report=1
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
179 new Xbuf1
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
180 new Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
181 let bnr = bufnr()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
182 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
183 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
184 bunload Xbuf1 Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
185 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
186 bdel Xbuf1 Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
187 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
188 bwipe Xbuf1 Xbuf2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
189 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
190 set report&
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
191 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
192
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
193 " 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
194 " command.
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
195 func Test_buffer_sbuf_cleanup()
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
196 call writefile([], 'XsplitCleanup', 'D')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
197 " 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
198 new XsplitCleanup
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
199 let bnr = bufnr()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
200 close
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
201 " create the swap file
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
202 call writefile([], '.XsplitCleanup.swp', 'D')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
203 " 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
204 au! SwapExists
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
205 augroup BufTest
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
206 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
207 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
208 augroup END
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
209 exe 'sbuf ' . bnr
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
210 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
211 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
212
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
213 " test for :sball
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
214 sball
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
215 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
216 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
217
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
218 %bw!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
219 set shortmess+=F
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
220 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
221 edit XsplitCleanup
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
222 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
223 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
224 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
225 set shortmess&
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
226
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
227 augroup BufTest
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
228 au!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
229 augroup END
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
230 augroup! BufTest
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
231 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
232
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
233 " 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
234 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
235 CheckUnix
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
236 CheckNotGui
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
237 CheckFeature dialog_con
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
238 new
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
239 call setline(1, 'test')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
240 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
241 call feedkeys('c', 'L')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
242 confirm bdel
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
243 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
244 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
245 call feedkeys('n', 'L')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
246 confirm bdel
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
247 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
248 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
249
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
250 " 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
251 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
252 CheckUnix
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
253 CheckNotGui
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
254 CheckFeature dialog_con
34780
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
255 " When dialog_con_gui is defined, Vim is compiled with GUI support
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
256 " and FEAT_BROWSE will be defined, which causes :confirm :b to
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
257 " call do_browse(), which will try to use a GUI file browser,
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
258 " which aborts if a GUI is not available.
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
259 CheckNotFeature dialog_con_gui
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
260 new XgotoConf
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
261 enew
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
262 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
263 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
264 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
265 call assert_fails('confirm b XgotoConf', 'E37:')
34780
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
266 call assert_true(&modified)
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
267 call assert_true(empty(bufname('%')))
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
268 call feedkeys('y', 'L')
34780
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
269 confirm b XgotoConf
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
270 call assert_equal('XgotoConf', bufname('%'))
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
271 call assert_equal(['test'], readfile('Untitled'))
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
272 e Untitled
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
273 call setline(2, 'test2')
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
274 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
275 confirm b XgotoConf
34780
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
276 call assert_equal('XgotoConf', bufname('%'))
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
277 call assert_equal(['test'], readfile('Untitled'))
54890be01c00 patch 9.1.0265: console dialog cannot save unnamed buffers
Christian Brabandt <cb@256bit.org>
parents: 34678
diff changeset
278 call delete('Untitled')
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()
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
328 call writefile(repeat(['one two'], 50), 'Xaltfile1', 'D')
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
329 call writefile(repeat(['five six'], 50), 'Xaltfile2', 'D')
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&
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
344 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
345
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
346 " 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
347 " modified buffer
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
348 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
349 %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
350 edit Xcountfile1
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
351 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
352 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
353 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
354 new Xcountfile4
20990
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
355 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
356 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
357 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
358 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
359 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
360 %bw!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
361 endfunc
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
362
22707
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
363 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
364 new SomeNewBuffer
22709
ecf0a8d6d4df patch 8.2.1903: buffer test fails with normal features
Bram Moolenaar <Bram@vim.org>
parents: 22707
diff changeset
365 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
366 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
367 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
368 new SomeNewBuffer
22709
ecf0a8d6d4df patch 8.2.1903: buffer test fails with normal features
Bram Moolenaar <Bram@vim.org>
parents: 22707
diff changeset
369 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
370 close
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
371 close
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
372 bwipe! SomeNewBuffer
30341
65c69861bad0 patch 9.0.0506: line number argument for :badd does not work
Bram Moolenaar <Bram@vim.org>
parents: 30158
diff changeset
373
65c69861bad0 patch 9.0.0506: line number argument for :badd does not work
Bram Moolenaar <Bram@vim.org>
parents: 30158
diff changeset
374 badd +3 XbaddFile
65c69861bad0 patch 9.0.0506: line number argument for :badd does not work
Bram Moolenaar <Bram@vim.org>
parents: 30158
diff changeset
375 call writefile(range(6), 'XbaddFile', 'D')
65c69861bad0 patch 9.0.0506: line number argument for :badd does not work
Bram Moolenaar <Bram@vim.org>
parents: 30158
diff changeset
376 buf XbaddFile
65c69861bad0 patch 9.0.0506: line number argument for :badd does not work
Bram Moolenaar <Bram@vim.org>
parents: 30158
diff changeset
377 call assert_equal([0, 3, 1, 0], getpos('.'))
65c69861bad0 patch 9.0.0506: line number argument for :badd does not work
Bram Moolenaar <Bram@vim.org>
parents: 30158
diff changeset
378
65c69861bad0 patch 9.0.0506: line number argument for :badd does not work
Bram Moolenaar <Bram@vim.org>
parents: 30158
diff changeset
379 bwipe! XbaddFile
22707
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
380 endfunc
9ff187b1652e patch 8.2.1902: default option values changed with :badd for existing buffer
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
381
22840
7c1e2e3f2d8d patch 8.2.1967: the session file does not restore the alternate file
Bram Moolenaar <Bram@vim.org>
parents: 22711
diff changeset
382 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
383 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
384 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
385 e #
7c1e2e3f2d8d patch 8.2.1967: the session file does not restore the alternate file
Bram Moolenaar <Bram@vim.org>
parents: 22711
diff changeset
386 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
387 endfunc
7c1e2e3f2d8d patch 8.2.1967: the session file does not restore the alternate file
Bram Moolenaar <Bram@vim.org>
parents: 22711
diff changeset
388
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
389 " 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
390 " 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
391 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
392 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
393
30158
008808e60963 patch 9.0.0415: on MS-Windows some tests are flaky
Bram Moolenaar <Bram@vim.org>
parents: 30110
diff changeset
394 set noswapfile
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
395 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
396 %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
397 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
398 \ #{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
399 \ #{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
400 \ #{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
401 \ #{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
402 \ #{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
403 \ #{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
404 \]
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 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
406 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
407 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
408 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
409 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
410 " 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
411 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
412 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
413 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
414 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
415
34a6db7af738 patch 8.2.3153: URLs with a dash in the scheme are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 24669
diff changeset
416 set shellslash&
30158
008808e60963 patch 9.0.0415: on MS-Windows some tests are flaky
Bram Moolenaar <Bram@vim.org>
parents: 30110
diff changeset
417 set swapfile&
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
418 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
419
28753
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
420 " 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
421 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
422 vsplit 0000000
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
423 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
424 bwipe!
28829
2d0bd5601c30 patch 8.2.4938: crash when matching buffer with invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28753
diff changeset
425
2d0bd5601c30 patch 8.2.4938: crash when matching buffer with invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28753
diff changeset
426 vsplit 00000000000000000000000000
2d0bd5601c30 patch 8.2.4938: crash when matching buffer with invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28753
diff changeset
427 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
428 bwipe!
28873
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
429
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
430 " similar case with different code path
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
431 split 0
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
432 edit ÿ
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
433 silent! buf [0--]\&\zs*\zs*0
c3570bdc93eb patch 8.2.4959: using NULL regexp program
Bram Moolenaar <Bram@vim.org>
parents: 28829
diff changeset
434 bwipe!
28753
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
435 endfunc
6e55b7b30df5 patch 8.2.4901: NULL pointer access when using invalid pattern
Bram Moolenaar <Bram@vim.org>
parents: 28289
diff changeset
436
24669
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
437 " 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
438 func Test_buffer_maxmem()
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
439 " 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
440 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
441 new
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
442 let v:errmsg = ''
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
443 " try opening some files
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
444 edit test_arglist.vim
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
445 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
446 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
447 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
448 b test_arglist.vim
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
449 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
450 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
451 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
452 close
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
453 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
454 set maxmem& maxmemtot&
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
455 endfunc
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
456
28289
cdaff4db7760 patch 8.2.4670: memory allocation failures for new tab page not tested
Bram Moolenaar <Bram@vim.org>
parents: 28285
diff changeset
457 " 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
458 func Test_buflist_alloc_failure()
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
459 %bw!
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
460
29950
c8b1a683323c patch 9.0.0313: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 28873
diff changeset
461 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
462 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
463 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
464
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
465 " 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
466 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
467 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
468
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
469 " 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
470 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
471 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
472 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
473
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
474 " 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
475 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
476 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
477 call delete('Xother')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
478
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
479 " 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
480 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
481 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
482
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
483 " 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
484 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
485 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
486
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
487 " 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
488 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
489 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
490
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
491 if has('terminal')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
492 " 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
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('call term_start(&shell)', 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
495 %bw!
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
496 endif
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
497
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
498 " 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
499 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
500 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
501 call assert_fails('%bw!', 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
502
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
503 " test for :checktime loading the buffer
30110
ba5ca7c7d44c patch 9.0.0391: using separate delete() call instead of writefile() 'D' flag
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
504 call writefile(['one'], 'XallocFail5', 'D')
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
505 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
506 edit XallocFail5
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
507 " 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
508 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
509 call writefile(['two'], 'XallocFail5')
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
510 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
511 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
512 call assert_fails('checktime', 'E342:')
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
513 set autoread&
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
514 bw!
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
515 endif
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
516
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
517 " 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
518 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
519 call assert_fails('vimgrep two XallocFail5', 'E342:')
28285
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
520
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
521 " 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
522 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
523 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
524 endfunc
a4aad5142959 patch 8.2.4668: buffer allocation failures insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 26376
diff changeset
525
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
526 " vim: shiftwidth=2 sts=2 expandtab