Mercurial > vim
annotate src/testdir/test_buffer.vim @ 19370:02111977dd05 v8.2.0243
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Commit: https://github.com/vim/vim/commit/9f6277bdde97b7767ded43a0b5a2023eb601b3b7
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 11 22:04:02 2020 +0100
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Problem: Insufficient code coverage for ex_docmd.c functions.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5618)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 11 Feb 2020 22:15:04 +0100 |
parents | |
children | 2f4be7ca1b1b |
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') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 " vim: shiftwidth=2 sts=2 expandtab |