annotate src/testdir/test_buffer.vim @ 19407:2f4be7ca1b1b v8.2.0261

patch 8.2.0261: some code not covered by tests Commit: https://github.com/vim/vim/commit/f0cee1971f5258ce61f8a4e6a04d35c1e625bb01 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 16 13:33:56 2020 +0100 patch 8.2.0261: some code not covered by tests Problem: Some code not covered by tests. Solution: Add test cases. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5645)
author Bram Moolenaar <Bram@vim.org>
date Sun, 16 Feb 2020 13:45:04 +0100
parents 02111977dd05
children 67fbe280a502
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
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " 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
4 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
5 %bwipe!
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 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
7 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
8 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
9 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
10
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 " 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
12 " 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
13 edit b1
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 new b2
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 new b3
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 new b4
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 bunload b2
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 bunload b3
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 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
21 .+3bunload
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 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
23 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
24 \ 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
25
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 " 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
27 " 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
28 ball
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 bunload b3
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 bunload b4
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 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
32 .+3bunload
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 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
34 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
35 \ 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
36
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 " 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
38 " 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
39 ball
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 bunload b2
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 bunload b3
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 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
43 .-3bunload
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 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
45 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
46 \ 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
47
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 " 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
49 " 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
50 ball
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 bunload b1
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 bunload b2
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 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
54 .-3bunload
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 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
56 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
57 \ 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
58
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 %bwipe!
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 call delete('b1')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 call delete('b2')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 call delete('b3')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 call delete('b4')
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
64
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
65 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
66 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
67
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
68 " Use a try-catch for this test. When assert_fails() is used for this
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
69 " test, the command fails with E515: instead of E90:
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
70 let caught_E90 = 0
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
71 try
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
72 $bunload
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
73 catch /E90:/
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
74 let caught_E90 = 1
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
75 endtry
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
76 call assert_equal(1, caught_E90)
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
77 call assert_fails('$bunload', 'E515:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
78 endfunc
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
79
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
80 " 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
81 " commands
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
82 func Test_buflist_browse()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
83 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
84 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
85
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
86 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
87 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
88 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
89 edit Xfile1
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
90 let b1 = bufnr()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
91 edit Xfile2
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
92 let b2 = bufnr()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
93 edit +/baz4 Xfile3
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
94 let b3 = bufnr()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
95
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
96 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
97 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
98 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
99 exe 'buffer +/bar2 ' .. b2
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
100 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
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 exe 'buffer +/bar1'
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
103 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
104 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
105
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
106 brewind +/foo3
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
107 call assert_equal(b1, bufnr())
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
108 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
109
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
110 blast +/baz2
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
111 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
112 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
113
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
114 bprevious +/bar4
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
115 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
116 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
117
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
118 bnext +/baz3
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
119 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
120 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
121
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
122 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
123 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
124 exe 'bmodified +/bar3'
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
125 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
126 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
127
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
128 " 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
129 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
130 set nobuflisted
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
131 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
132 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
133 set buflisted
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
134
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
135 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
136
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
137 call delete('Xfile1')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
138 call delete('Xfile2')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
139 call delete('Xfile3')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
140 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
141 endfunc
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 " Test for :bdelete
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
144 func Test_bdelete_cmd()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
145 %bwipe!
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
146 call assert_fails('bdelete 5', 'E516:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
147
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
148 " 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
149 edit Xfile1
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
150 let bnr = bufnr()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
151 set nobuflisted
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
152 enew
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
153 call assert_fails('bdelete ' .. bnr, 'E516:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
154 %bwipe!
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 " vim: shiftwidth=2 sts=2 expandtab