Mercurial > vim
annotate src/testdir/test_perl.vim @ 11445:461ac47c3793 v8.0.0606
patch 8.0.0606: cannot set the context for a specified quickfix list
commit https://github.com/vim/vim/commit/6e62da3e14d32f76f60d5cc8b267059923842f17
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 28 08:16:25 2017 +0200
patch 8.0.0606: cannot set the context for a specified quickfix list
Problem: Cannot set the context for a specified quickfix list.
Solution: Use the list index instead of the current list. (Yegappan
Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 28 May 2017 08:30:03 +0200 |
parents | 1c4ebbae41d2 |
children | 142c0083b3b8 |
rev | line source |
---|---|
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for Perl interface |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 if !has('perl') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 finish |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 end |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
7655
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
7 func Test_change_buffer() |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
8 call setline(line('$'), ['1 line 1']) |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
9 perl VIM::DoCommand("normal /^1\n") |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
10 perl $curline = VIM::Eval("line('.')") |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
11 perl $curbuf->Set($curline, "1 changed line 1") |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
12 call assert_equal('1 changed line 1', getline('$')) |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
13 endfunc |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
14 |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
15 func Test_evaluate_list() |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
16 call setline(line('$'), ['2 line 2']) |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
17 perl VIM::DoCommand("normal /^2\n") |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
18 perl $curline = VIM::Eval("line('.')") |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
19 let l = ["abc", "def"] |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
20 perl << EOF |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
21 $l = VIM::Eval("l"); |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
22 $curbuf->Append($curline, $l); |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
23 EOF |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
24 normal j |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
25 .perldo s|\n|/|g |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
26 call assert_equal('abc/def/', getline('$')) |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
27 endfunc |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
29 func Test_buffer_Delete() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
30 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
31 call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
32 perl $curbuf->Delete(7) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
33 perl $curbuf->Delete(2, 5) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
34 perl $curbuf->Delete(10) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
35 call assert_equal(['a', 'f', 'h'], getline(1, '$')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
36 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
37 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
38 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
39 func Test_buffer_Append() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
40 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
41 perl $curbuf->Append(1, '1') |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
42 perl $curbuf->Append(2, '2', '3', '4') |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
43 perl @l = ('5' ..'7') |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
44 perl $curbuf->Append(0, @l) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
45 call assert_equal(['5', '6', '7', '', '1', '2', '3', '4'], getline(1, '$')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
46 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
47 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
48 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
49 func Test_buffer_Set() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
50 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
51 call setline(1, ['1', '2', '3', '4', '5']) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
52 perl $curbuf->Set(2, 'a', 'b', 'c') |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
53 perl $curbuf->Set(4, 'A', 'B', 'C') |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
54 call assert_equal(['1', 'a', 'b', 'A', 'B'], getline(1, '$')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
55 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
56 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
57 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
58 func Test_buffer_Get() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
59 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
60 call setline(1, ['1', '2', '3', '4']) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
61 call assert_equal('2:3', perleval('join(":", $curbuf->Get(2, 3))')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
62 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
63 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
64 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
65 func Test_buffer_Count() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
66 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
67 call setline(1, ['a', 'b', 'c']) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
68 call assert_equal(3, perleval('$curbuf->Count()')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
69 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
70 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
71 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
72 func Test_buffer_Name() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
73 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
74 call assert_equal('', perleval('$curbuf->Name()')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
75 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
76 new Xfoo |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
77 call assert_equal('Xfoo', perleval('$curbuf->Name()')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
78 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
79 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
80 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
81 func Test_buffer_Number() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
82 call assert_equal(bufnr('%'), perleval('$curbuf->Number()')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
83 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
84 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
85 func Test_window_Cursor() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
86 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
87 call setline(1, ['line1', 'line2']) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
88 perl $curwin->Cursor(2, 3) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
89 call assert_equal('2:3', perleval('join(":", $curwin->Cursor())')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
90 " Col is numbered from 0 in Perl, and from 1 in Vim script. |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
91 call assert_equal([0, 2, 4, 0], getpos('.')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
92 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
93 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
94 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
95 func Test_window_SetHeight() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
96 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
97 perl $curwin->SetHeight(2) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
98 call assert_equal(2, winheight(0)) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
99 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
100 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
101 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
102 func Test_VIM_Windows() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
103 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
104 " VIM::Windows() without argument in scalar and list context. |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
105 perl $winnr = VIM::Windows() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
106 perl @winlist = VIM::Windows() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
107 perl $curbuf->Append(0, $winnr, scalar(@winlist)) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
108 call assert_equal(['2', '2', ''], getline(1, '$')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
109 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
110 " VIM::Windows() with window number argument. |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
111 perl VIM::Windows(VIM::Eval('winnr()'))->Buffer()->Set(1, 'bar') |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
112 call assert_equal('bar', getline(1)) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
113 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
114 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
115 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
116 func Test_VIM_Buffers() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
117 new Xbar |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
118 " VIM::Buffers() without argument in scalar and list context. |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
119 perl $nbuf = VIM::Buffers() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
120 perl @buflist = VIM::Buffers() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
121 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
122 " VIM::Buffers() with argument. |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
123 perl $mybuf = (VIM::Buffers('Xbar'))[0] |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
124 perl $mybuf->Append(0, $nbuf, scalar(@buflist)) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
125 call assert_equal(['2', '2', ''], getline(1, '$')) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
126 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
127 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
128 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
129 func <SID>catch_peval(expr) |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 try |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 call perleval(a:expr) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 catch |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 return v:exception |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 endtry |
11183
1c4ebbae41d2
patch 8.0.0478: tests use assert_true(0) and assert_false(1) to report errors
Christian Brabandt <cb@256bit.org>
parents:
10922
diff
changeset
|
135 call assert_report('no exception for `perleval("'.a:expr.'")`') |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 return '' |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
137 endfunc |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
139 func Test_perleval() |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 call assert_false(perleval('undef')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 " scalar |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 call assert_equal(0, perleval('0')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 call assert_equal(2, perleval('2')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 call assert_equal(-2, perleval('-2')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 if has('float') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 call assert_equal(2.5, perleval('2.5')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 else |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 call assert_equal(2, perleval('2.5')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 end |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 sandbox call assert_equal(2, perleval('2')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 call assert_equal('abc', perleval('"abc"')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 call assert_equal("abc\ndef", perleval('"abc\0def"')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 " ref |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 call assert_equal([], perleval('[]')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 call assert_equal(['word', 42, [42],{}], perleval('["word", 42, [42], {}]')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 call assert_equal({}, perleval('{}')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 call assert_equal({'foo': 'bar'}, perleval('{foo => "bar"}')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 perl our %h; our @a; |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 let a = perleval('[\(%h, %h, @a, @a)]') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 call assert_true((a[0] is a[1])) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 call assert_true((a[2] is a[3])) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 perl undef %h; undef @a; |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 call assert_true(<SID>catch_peval('{"" , 0}') =~ 'Malformed key Dictionary') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 call assert_true(<SID>catch_peval('{"\0" , 0}') =~ 'Malformed key Dictionary') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 call assert_true(<SID>catch_peval('{"foo\0bar" , 0}') =~ 'Malformed key Dictionary') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 call assert_equal('*VIM', perleval('"*VIM"')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 call assert_true(perleval('\\0') =~ 'SCALAR(0x\x\+)') |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
176 endfunc |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
178 func Test_perldo() |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 sp __TEST__ |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 exe 'read ' g:testname |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 perldo s/perl/vieux_chameau/g |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 1 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 call assert_false(search('\Cperl')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 bw! |
10759
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
185 |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
186 " Check deleting lines does not trigger ml_get error. |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
187 new |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
188 call setline(1, ['one', 'two', 'three']) |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
189 perldo VIM::DoCommand("%d_") |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
190 bwipe! |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
191 |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
192 " Check switching to another buffer does not trigger ml_get error. |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
193 new |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
194 let wincount = winnr('$') |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
195 call setline(1, ['one', 'two', 'three']) |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
196 perldo VIM::DoCommand("new") |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
197 call assert_equal(wincount + 1, winnr('$')) |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
198 bwipe! |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
199 bwipe! |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
200 endfunc |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
202 func Test_VIM_package() |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 perl VIM::DoCommand('let l:var = "foo"') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 call assert_equal(l:var, 'foo') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 set noet |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 perl VIM::SetOption('et') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 call assert_true(&et) |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
209 endfunc |
8885
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
210 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
211 func Test_stdio() |
8885
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
212 redir =>l:out |
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
213 perl <<EOF |
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
214 VIM::Msg("&VIM::Msg"); |
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
215 print "STDOUT"; |
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
216 print STDERR "STDERR"; |
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
217 EOF |
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
218 redir END |
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
219 call assert_equal(['&VIM::Msg', 'STDOUT', 'STDERR'], split(l:out, "\n")) |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
220 endfunc |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
221 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
222 func Test_SvREFCNT() |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
223 new t |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
224 perl <<--perl |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
225 my ($b, $w); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
226 $b = $curbuf for 0 .. 10; |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
227 $w = $curwin for 0 .. 10; |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
228 VIM::DoCommand('bw! t'); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
229 if (exists &Internals::SvREFCNT) { |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
230 my $cb = Internals::SvREFCNT($$b); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
231 my $cw = Internals::SvREFCNT($$w); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
232 VIM::Eval("assert_equal(2, $cb)"); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
233 VIM::Eval("assert_equal(2, $cw)"); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
234 } |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
235 VIM::Eval("assert_false($$b)"); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
236 VIM::Eval("assert_false($$w)"); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
237 --perl |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
238 endfunc |