annotate src/testdir/test_buffer.vim @ 25188:8998dff30044 v8.2.3130

patch 8.2.3130: Vim9: import test fails Commit: https://github.com/vim/vim/commit/b885a7c72c8fed5f14454633fb3ba9d77fff1c24 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 8 22:02:11 2021 +0200 patch 8.2.3130: Vim9: import test fails Problem: Vim9: import test fails. Solution: Rename directory back to "import", use "p" to avoid an error when the directory already exists.
author Bram Moolenaar <Bram@vim.org>
date Thu, 08 Jul 2021 22:15:03 +0200
parents d7644bffe128
children 34a6db7af738
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
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
79 call writefile(['foo1', 'foo2', 'foo3', 'foo4'], 'Xfile1')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
80 call writefile(['bar1', 'bar2', 'bar3', 'bar4'], 'Xfile2')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
81 call writefile(['baz1', 'baz2', 'baz3', 'baz4'], 'Xfile3')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
82 edit Xfile1
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
83 let b1 = bufnr()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
84 edit Xfile2
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
85 let b2 = bufnr()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
86 edit +/baz4 Xfile3
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
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
130 call delete('Xfile1')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
131 call delete('Xfile2')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
132 call delete('Xfile3')
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
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
144 edit Xfile1
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()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
203 call writefile([], 'Xfile')
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
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
205 new Xfile
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
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
209 call writefile([], '.Xfile.swp')
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!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
214 autocmd SwapExists Xfile let v:swapchoice='q'
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('$'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
218 call assert_equal(0, getbufinfo('Xfile')[0].loaded)
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('$'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
223 call assert_equal(0, getbufinfo('Xfile')[0].loaded)
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 = ''
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
228 edit Xfile
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('$'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
231 call assert_equal(0, getbufinfo('Xfile')[0].loaded)
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
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
234 call delete('Xfile')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
235 call delete('.Xfile.swp')
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
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
264 new Xfile
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')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
267 call assert_fails('b Xfile', 'E37:')
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')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
269 call assert_fails('confirm b Xfile', 'E37:')
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')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20990
diff changeset
273 call assert_fails('confirm b Xfile', ['', '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')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
277 confirm b Xfile
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
278 call assert_equal('Xfile', @%)
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()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
284 new Xfile
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
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
287 sbuf Xfile
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
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
292 sbuf Xfile
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!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
304 autocmd BufAdd Xfile %bw!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
305 augroup END
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
306 edit Xfile
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
307 call assert_equal('', @%)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
308 call assert_equal(0, bufexists('Xfile'))
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()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
318 new Xfile1
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
319 edit Xfile2
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()
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
328 call writefile(repeat(['one two'], 50), 'Xfile1')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
329 call writefile(repeat(['five six'], 50), 'Xfile2')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
330 set nosol
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
331 edit Xfile1
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)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
333 edit Xfile2
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('.'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
339 buf Xfile1
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('.'))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
341 buf Xfile2
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 call delete('Xfile1')
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
345 call delete('Xfile2')
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!
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
352 edit Xfile1
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'])
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
354 new Xfile2
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
355 new Xfile3
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
356 new Xfile4
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
357 2sball
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
358 call assert_equal(bufnr('Xfile4'), winbufnr(1))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
359 call assert_equal(bufnr('Xfile1'), winbufnr(2))
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
360 call assert_equal(0, getbufinfo('Xfile2')[0].loaded)
55b3849ded11 patch 8.2.1046: insufficient tests for src/buffer.c
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
361 call assert_equal(0, getbufinfo('Xfile3')[0].loaded)
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
24669
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
384 " 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
385 func Test_buffer_maxmem()
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
386 " 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
387 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
388 new
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
389 let v:errmsg = ''
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
390 " try opening some files
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
391 edit test_arglist.vim
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
392 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
393 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
394 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
395 b test_arglist.vim
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
396 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
397 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
398 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
399 close
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
400 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
401 set maxmem& maxmemtot&
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
402 endfunc
d7644bffe128 patch 8.2.2873: not enough tests for writing buffers
Bram Moolenaar <Bram@vim.org>
parents: 22840
diff changeset
403
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
404 " vim: shiftwidth=2 sts=2 expandtab