Mercurial > vim
annotate src/testdir/test_perl.vim @ 34298:5525b635ed4a v9.1.0084
patch 9.1.0084: Visual hl wrong when it ends before multibyte 'showbreak'
Commit: https://github.com/vim/vim/commit/df23d7f4bd7546f3152ea003856525591218565b
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri Feb 9 18:14:12 2024 +0100
patch 9.1.0084: Visual hl wrong when it ends before multibyte 'showbreak'
Problem: Visual hl wrong when it ends before multibyte 'showbreak'.
(lacygoil)
Solution: Use vcol_sbr instead of adding n_extra.
(zeertzjq)
fixes: #11272
closes: #13996
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 09 Feb 2024 18:30:04 +0100 |
parents | daaff6843090 |
children |
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 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
3 source check.vim |
24616
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
4 source shared.vim |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
5 CheckFeature perl |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
14441
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
7 " FIXME: RunTest don't see any error when Perl abort... |
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
8 perl $SIG{__WARN__} = sub { die "Unexpected warnings from perl: @_" }; |
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
9 |
7655
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
10 func Test_change_buffer() |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
11 call setline(line('$'), ['1 line 1']) |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
12 perl VIM::DoCommand("normal /^1\n") |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
13 perl $curline = VIM::Eval("line('.')") |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
14 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
|
15 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
|
16 endfunc |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
17 |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
18 func Test_evaluate_list() |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
19 call setline(line('$'), ['2 line 2']) |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
20 perl VIM::DoCommand("normal /^2\n") |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
21 perl $curline = VIM::Eval("line('.')") |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
22 let l = ["abc", "def"] |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
23 perl << EOF |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
24 $l = VIM::Eval("l"); |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
25 $curbuf->Append($curline, $l); |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
26 EOF |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
27 normal j |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
28 .perldo s|\n|/|g |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
29 call assert_equal('abc/def/', getline('$')) |
94f34dc2f254
commit https://github.com/vim/vim/commit/021b593e7ed6c7111cbf189744ad1e5d6c4a7d79
Christian Brabandt <cb@256bit.org>
parents:
7651
diff
changeset
|
30 endfunc |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 |
15945
f0f8754e3bf5
patch 8.1.0978: blob not tested with Perl
Bram Moolenaar <Bram@vim.org>
parents:
14441
diff
changeset
|
32 funct Test_VIM_Blob() |
f0f8754e3bf5
patch 8.1.0978: blob not tested with Perl
Bram Moolenaar <Bram@vim.org>
parents:
14441
diff
changeset
|
33 call assert_equal('0z', perleval('VIM::Blob("")')) |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
34 call assert_equal('0z31326162', 'VIM::Blob("12ab")'->perleval()) |
15945
f0f8754e3bf5
patch 8.1.0978: blob not tested with Perl
Bram Moolenaar <Bram@vim.org>
parents:
14441
diff
changeset
|
35 call assert_equal('0z00010203', perleval('VIM::Blob("\x00\x01\x02\x03")')) |
f0f8754e3bf5
patch 8.1.0978: blob not tested with Perl
Bram Moolenaar <Bram@vim.org>
parents:
14441
diff
changeset
|
36 call assert_equal('0z8081FEFF', perleval('VIM::Blob("\x80\x81\xfe\xff")')) |
f0f8754e3bf5
patch 8.1.0978: blob not tested with Perl
Bram Moolenaar <Bram@vim.org>
parents:
14441
diff
changeset
|
37 endfunc |
f0f8754e3bf5
patch 8.1.0978: blob not tested with Perl
Bram Moolenaar <Bram@vim.org>
parents:
14441
diff
changeset
|
38 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
39 func Test_buffer_Delete() |
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 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
|
42 perl $curbuf->Delete(7) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
43 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
|
44 perl $curbuf->Delete(10) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
45 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
|
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_Append() |
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 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
|
52 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
|
53 perl @l = ('5' ..'7') |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
54 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
|
55 call assert_equal(['5', '6', '7', '', '1', '2', '3', '4'], getline(1, '$')) |
24616
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
56 |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
57 perl $curbuf->Append(0) |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
58 call assert_match('^Usage: VIBUF::Append(vimbuf, lnum, @lines) at .* line 1\.$', |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
59 \ GetMessages()[-1]) |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
60 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
61 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
62 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
63 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
64 func Test_buffer_Set() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
65 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
66 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
|
67 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
|
68 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
|
69 call assert_equal(['1', 'a', 'b', 'A', 'B'], getline(1, '$')) |
24616
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
70 |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
71 perl $curbuf->Set(0) |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
72 call assert_match('^Usage: VIBUF::Set(vimbuf, lnum, @lines) at .* line 1\.$', |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
73 \ GetMessages()[-1]) |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
74 |
10922
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 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
77 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
78 func Test_buffer_Get() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
79 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
80 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
|
81 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
|
82 bwipe! |
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_buffer_Count() |
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, ['a', 'b', 'c']) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
88 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
|
89 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
90 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
91 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
92 func Test_buffer_Name() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
93 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
94 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
|
95 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
96 new Xfoo |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
97 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
|
98 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
99 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
100 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
101 func Test_buffer_Number() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
102 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
|
103 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
104 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
105 func Test_window_Cursor() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
106 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
107 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
|
108 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
|
109 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
|
110 " 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
|
111 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
|
112 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
113 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
114 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
115 func Test_window_SetHeight() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
116 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
117 perl $curwin->SetHeight(2) |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
118 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
|
119 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
120 endfunc |
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 func Test_VIM_Windows() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
123 new |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
124 " 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
|
125 perl $winnr = VIM::Windows() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
126 perl @winlist = VIM::Windows() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
127 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
|
128 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
|
129 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
130 " 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
|
131 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
|
132 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
|
133 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
134 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
135 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
136 func Test_VIM_Buffers() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
137 new Xbar |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
138 " 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
|
139 perl $nbuf = VIM::Buffers() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
140 perl @buflist = VIM::Buffers() |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
141 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
142 " VIM::Buffers() with argument. |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
143 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
|
144 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
|
145 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
|
146 bwipe! |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
147 endfunc |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
148 |
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
149 func <SID>catch_peval(expr) |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 try |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 call perleval(a:expr) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 catch |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 return v:exception |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 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
|
155 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
|
156 return '' |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
157 endfunc |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
159 func Test_perleval() |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 call assert_false(perleval('undef')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 " scalar |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 call assert_equal(0, perleval('0')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 call assert_equal(2, perleval('2')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 call assert_equal(-2, perleval('-2')) |
30310
029c59bf78f1
patch 9.0.0491: no good reason to build without the float feature
Bram Moolenaar <Bram@vim.org>
parents:
28827
diff
changeset
|
166 call assert_equal(2.5, perleval('2.5')) |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 sandbox call assert_equal(2, perleval('2')) |
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_equal('abc', perleval('"abc"')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 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
|
172 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 " ref |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 call assert_equal([], perleval('[]')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 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
|
176 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 call assert_equal({}, perleval('{}')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 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
|
179 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 perl our %h; our @a; |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 let a = perleval('[\(%h, %h, @a, @a)]') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 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
|
183 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
|
184 perl undef %h; undef @a; |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 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
|
187 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
|
188 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
|
189 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 call assert_equal('*VIM', perleval('"*VIM"')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 call assert_true(perleval('\\0') =~ 'SCALAR(0x\x\+)') |
23148
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
192 |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
193 " typeglob |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
194 call assert_equal('*main::STDOUT', perleval('*STDOUT')) |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
195 ' |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
196 call perleval("++-$foo") |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
197 let messages = split(execute('message'), "\n") |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
198 call assert_match("Can't modify negation", messages[-1]) |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
199 endfunc |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
201 func Test_perldo() |
23148
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
202 new |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
203 " :perldo in empty buffer does nothing. |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
204 perldo ++$counter |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
205 call assert_equal(0, perleval("$counter")) |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
206 |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 sp __TEST__ |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 exe 'read ' g:testname |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 perldo s/perl/vieux_chameau/g |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 1 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 call assert_false(search('\Cperl')) |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 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
|
213 |
34234
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
214 new |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
215 |
10759
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
216 " 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
|
217 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
|
218 perldo VIM::DoCommand("%d_") |
34234
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
219 call assert_equal([''], getline(1, '$')) |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
220 |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
221 call setline(1, ['one', 'two', 'three']) |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
222 perldo VIM::DoCommand("1,2d_") |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
223 call assert_equal(['three'], getline(1, '$')) |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
224 |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
225 call setline(1, ['one', 'two', 'three']) |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
226 perldo VIM::DoCommand("2,3d_"); $_ = "REPLACED" |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
227 call assert_equal(['REPLACED'], getline(1, '$')) |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
228 |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
229 call setline(1, ['one', 'two', 'three']) |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
230 2,3perldo VIM::DoCommand("1,2d_"); $_ = "REPLACED" |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
231 call assert_equal(['three'], getline(1, '$')) |
daaff6843090
patch 9.1.0062: Internal error when :luado/perldo/pydo etc delete lines
Christian Brabandt <cb@256bit.org>
parents:
30310
diff
changeset
|
232 |
10759
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
233 bwipe! |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
234 |
24616
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
235 " Check a Perl expression which gives an error. |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
236 new |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
237 call setline(1, 'one') |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
238 perldo 1/0 |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
239 call assert_match('^Illegal division by zero at .* line 1\.$', GetMessages()[-1]) |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
240 bwipe! |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
241 |
10759
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
242 " 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
|
243 new |
4267f8904d47
patch 8.0.0269: may get ml_get error when :perldo deletes lines
Christian Brabandt <cb@256bit.org>
parents:
8919
diff
changeset
|
244 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
|
245 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
|
246 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
|
247 call assert_equal(wincount + 1, winnr('$')) |
23148
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
248 %bwipe! |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
249 endfunc |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
250 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
251 func Test_VIM_package() |
7651
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
252 perl VIM::DoCommand('let l:var = "foo"') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 call assert_equal(l:var, 'foo') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
255 set noet |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
256 perl VIM::SetOption('et') |
c7575b07de98
commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 call assert_true(&et) |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
258 endfunc |
8885
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
259 |
10922
2cc7e86bdada
patch 8.0.0350: not enough test coverage for Perl
Christian Brabandt <cb@256bit.org>
parents:
10759
diff
changeset
|
260 func Test_stdio() |
8885
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
261 redir =>l:out |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
262 perl << trim EOF |
24616
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
263 VIM::Msg("VIM::Msg"); |
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
264 VIM::Msg("VIM::Msg Error", "Error"); |
8885
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
265 print "STDOUT"; |
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
266 print STDERR "STDERR"; |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
267 EOF |
8885
54a380c74547
commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents:
7655
diff
changeset
|
268 redir END |
24616
ed4d7ab9dcdc
patch 8.2.2847: Perl not tested sufficiently
Bram Moolenaar <Bram@vim.org>
parents:
23148
diff
changeset
|
269 call assert_equal(['VIM::Msg', 'VIM::Msg Error', '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
|
270 endfunc |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
271 |
14350
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
272 " Run first to get a clean namespace |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
273 func Test_000_SvREFCNT() |
14352
af9f7521cc73
patch 8.1.0191: Perl test fails in 24 line terminal
Christian Brabandt <cb@256bit.org>
parents:
14350
diff
changeset
|
274 for i in range(8) |
14350
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
275 exec 'new X'.i |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
276 endfor |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
277 new t |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
278 perl <<--perl |
14350
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
279 #line 5 "Test_000_SvREFCNT()" |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
280 my ($b, $w); |
14350
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
281 |
14441
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
282 my $num = 0; |
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
283 for ( 0 .. 100 ) { |
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
284 if ( ++$num >= 8 ) { $num = 0 } |
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
285 VIM::DoCommand("buffer X$num"); |
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
286 $b = $curbuf; |
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
287 } |
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
288 |
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
289 VIM::DoCommand("buffer t"); |
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
290 |
14350
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
291 $b = $curbuf for 0 .. 100; |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
292 $w = $curwin for 0 .. 100; |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
293 () = VIM::Buffers for 0 .. 100; |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
294 () = VIM::Windows for 0 .. 100; |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
295 |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
296 VIM::DoCommand('bw! t'); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
297 if (exists &Internals::SvREFCNT) { |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
298 my $cb = Internals::SvREFCNT($$b); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
299 my $cw = Internals::SvREFCNT($$w); |
14350
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
300 VIM::Eval("assert_equal(2, $cb, 'T1')"); |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
301 VIM::Eval("assert_equal(2, $cw, 'T2')"); |
14441
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
302 my $strongref; |
14350
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
303 foreach ( VIM::Buffers, VIM::Windows ) { |
14441
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
304 VIM::DoCommand("%bw!"); |
14350
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
305 my $c = Internals::SvREFCNT($_); |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
306 VIM::Eval("assert_equal(2, $c, 'T3')"); |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
307 $c = Internals::SvREFCNT($$_); |
14441
2d6703d4448a
patch 8.1.0234: incorrect reference counting in Perl interface
Christian Brabandt <cb@256bit.org>
parents:
14395
diff
changeset
|
308 next if $c == 2 && !$strongref++; |
14350
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
309 VIM::Eval("assert_equal(1, $c, 'T4')"); |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
310 } |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
311 $cb = Internals::SvREFCNT($$curbuf); |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
312 $cw = Internals::SvREFCNT($$curwin); |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
313 VIM::Eval("assert_equal(3, $cb, 'T5')"); |
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
314 VIM::Eval("assert_equal(3, $cw, 'T6')"); |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
315 } |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
316 VIM::Eval("assert_false($$b)"); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
317 VIM::Eval("assert_false($$w)"); |
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
318 --perl |
14350
142c0083b3b8
patch 8.1.0190: Perl refcounts are wrong
Christian Brabandt <cb@256bit.org>
parents:
11183
diff
changeset
|
319 %bw! |
8919
240ad5a78199
commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents:
8885
diff
changeset
|
320 endfunc |
14395
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
321 |
28827
91b2386b9d9e
patch 8.2.4937: no test for what 8.2.4931 fixes
Bram Moolenaar <Bram@vim.org>
parents:
24616
diff
changeset
|
322 " This caused a memory error before issue #10386 was fixed |
91b2386b9d9e
patch 8.2.4937: no test for what 8.2.4931 fixes
Bram Moolenaar <Bram@vim.org>
parents:
24616
diff
changeset
|
323 func Test_stack_usage_fix() |
91b2386b9d9e
patch 8.2.4937: no test for what 8.2.4931 fixes
Bram Moolenaar <Bram@vim.org>
parents:
24616
diff
changeset
|
324 let script =<< CODE |
91b2386b9d9e
patch 8.2.4937: no test for what 8.2.4931 fixes
Bram Moolenaar <Bram@vim.org>
parents:
24616
diff
changeset
|
325 " This will grow Perl's stack in first invocation |
91b2386b9d9e
patch 8.2.4937: no test for what 8.2.4931 fixes
Bram Moolenaar <Bram@vim.org>
parents:
24616
diff
changeset
|
326 eval [0, 0]->map({ -> perleval("push@_,0..4096;0") }) |
91b2386b9d9e
patch 8.2.4937: no test for what 8.2.4931 fixes
Bram Moolenaar <Bram@vim.org>
parents:
24616
diff
changeset
|
327 q! |
91b2386b9d9e
patch 8.2.4937: no test for what 8.2.4931 fixes
Bram Moolenaar <Bram@vim.org>
parents:
24616
diff
changeset
|
328 CODE |
91b2386b9d9e
patch 8.2.4937: no test for what 8.2.4931 fixes
Bram Moolenaar <Bram@vim.org>
parents:
24616
diff
changeset
|
329 call RunVim([], script, '') |
91b2386b9d9e
patch 8.2.4937: no test for what 8.2.4931 fixes
Bram Moolenaar <Bram@vim.org>
parents:
24616
diff
changeset
|
330 endfunc |
91b2386b9d9e
patch 8.2.4937: no test for what 8.2.4931 fixes
Bram Moolenaar <Bram@vim.org>
parents:
24616
diff
changeset
|
331 |
14395
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
332 func Test_set_cursor() |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
333 " Check that setting the cursor position works. |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
334 new |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
335 call setline(1, ['first line', 'second line']) |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
336 normal gg |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
337 perldo $curwin->Cursor(1, 5) |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
338 call assert_equal([1, 6], [line('.'), col('.')]) |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
339 |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
340 " Check that movement after setting cursor position keeps current column. |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
341 normal j |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
342 call assert_equal([2, 6], [line('.'), col('.')]) |
c15bef307de6
patch 8.1.0212: preferred cursor column not set in interfaces
Christian Brabandt <cb@256bit.org>
parents:
14352
diff
changeset
|
343 endfunc |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
344 |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
345 " Test for various heredoc syntax |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
346 func Test_perl_heredoc() |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
347 perl << END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
348 VIM::DoCommand('let s = "A"') |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
349 END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
350 perl << |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
351 VIM::DoCommand('let s ..= "B"') |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
352 . |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
353 perl << trim END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
354 VIM::DoCommand('let s ..= "C"') |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
355 END |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
356 perl << trim |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
357 VIM::DoCommand('let s ..= "D"') |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
358 . |
20233
5f9c2c7d3d73
patch 8.2.0672: heredoc in scripts does not accept lower case marker
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
359 perl << trim eof |
5f9c2c7d3d73
patch 8.2.0672: heredoc in scripts does not accept lower case marker
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
360 VIM::DoCommand('let s ..= "E"') |
5f9c2c7d3d73
patch 8.2.0672: heredoc in scripts does not accept lower case marker
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
361 eof |
5f9c2c7d3d73
patch 8.2.0672: heredoc in scripts does not accept lower case marker
Bram Moolenaar <Bram@vim.org>
parents:
20045
diff
changeset
|
362 call assert_equal('ABCDE', s) |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
363 endfunc |
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
364 |
23148
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
365 func Test_perl_in_sandbox() |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
366 sandbox perl print 'test' |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
367 let messages = split(execute('message'), "\n") |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
368 call assert_match("'print' trapped by operation mask", messages[-1]) |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
369 endfunc |
4637f7a4c753
patch 8.2.2120: not all Perl functionality is tested
Bram Moolenaar <Bram@vim.org>
parents:
20233
diff
changeset
|
370 |
20045
04ef2ccf2519
patch 8.2.0578: heredoc for interfaces does not support "trim"
Bram Moolenaar <Bram@vim.org>
parents:
17976
diff
changeset
|
371 " vim: shiftwidth=2 sts=2 expandtab |