annotate src/testdir/test_perl.vim @ 10755:2f735d1d1954 v8.0.0267

patch 8.0.0267: channel test sometimes fails on Mac commit https://github.com/vim/vim/commit/6fe2eb43d2527cc8a3450456a60639e87f16d32d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 29 21:49:51 2017 +0100 patch 8.0.0267: channel test sometimes fails on Mac Problem: A channel test sometimes fails on Mac. Solution: Add the test to the list of flaky tests.
author Christian Brabandt <cb@256bit.org>
date Sun, 29 Jan 2017 22:00:04 +0100
parents 240ad5a78199
children 4267f8904d47
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 fu <SID>catch_peval(expr)
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 try
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call perleval(a:expr)
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 catch
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 return v:exception
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 endtry
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_true(0, 'no exception for `perleval("'.a:expr.'")`')
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 return ''
8919
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
37 endfunc
7651
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 function Test_perleval()
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_false(perleval('undef'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 " scalar
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call assert_equal(0, perleval('0'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call assert_equal(2, perleval('2'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal(-2, perleval('-2'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 if has('float')
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 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
48 else
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 call assert_equal(2, perleval('2.5'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 end
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 sandbox call assert_equal(2, perleval('2'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 call assert_equal('abc', perleval('"abc"'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 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
56
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 " ref
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 call assert_equal([], perleval('[]'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 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
60
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 call assert_equal({}, perleval('{}'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 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
63
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 perl our %h; our @a;
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 let a = perleval('[\(%h, %h, @a, @a)]')
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 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
67 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
68 perl undef %h; undef @a;
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 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
71 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
72 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
73
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call assert_equal('*VIM', perleval('"*VIM"'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 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
76 endfunc
7651
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 function Test_perldo()
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 sp __TEST__
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 exe 'read ' g:testname
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 perldo s/perl/vieux_chameau/g
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 1
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_false(search('\Cperl'))
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 bw!
8919
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
85 endfunc
7651
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 function Test_VIM_package()
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 perl VIM::DoCommand('let l:var = "foo"')
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 call assert_equal(l:var, 'foo')
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 set noet
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 perl VIM::SetOption('et')
c7575b07de98 commit https://github.com/vim/vim/commit/e9b892ebcd8596bf813793a1eed5a460a9495a28
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 call assert_true(&et)
8919
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
94 endfunc
8885
54a380c74547 commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents: 7655
diff changeset
95
54a380c74547 commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents: 7655
diff changeset
96 function Test_stdio()
54a380c74547 commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents: 7655
diff changeset
97 redir =>l:out
54a380c74547 commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents: 7655
diff changeset
98 perl <<EOF
54a380c74547 commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents: 7655
diff changeset
99 VIM::Msg("&VIM::Msg");
54a380c74547 commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents: 7655
diff changeset
100 print "STDOUT";
54a380c74547 commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents: 7655
diff changeset
101 print STDERR "STDERR";
54a380c74547 commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents: 7655
diff changeset
102 EOF
54a380c74547 commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents: 7655
diff changeset
103 redir END
54a380c74547 commit https://github.com/vim/vim/commit/6244a0fc29163ba1c734f92b55a89e01e6cf2a67
Christian Brabandt <cb@256bit.org>
parents: 7655
diff changeset
104 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
105 endfunc
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
106
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
107 function Test_SvREFCNT()
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
108 new t
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
109 perl <<--perl
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
110 my ($b, $w);
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
111 $b = $curbuf for 0 .. 10;
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
112 $w = $curwin for 0 .. 10;
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
113 VIM::DoCommand('bw! t');
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
114 if (exists &Internals::SvREFCNT) {
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
115 my $cb = Internals::SvREFCNT($$b);
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
116 my $cw = Internals::SvREFCNT($$w);
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
117 VIM::Eval("assert_equal(2, $cb)");
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
118 VIM::Eval("assert_equal(2, $cw)");
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
119 }
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
120 VIM::Eval("assert_false($$b)");
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
121 VIM::Eval("assert_false($$w)");
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
122 --perl
240ad5a78199 commit https://github.com/vim/vim/commit/95509e18f8806046eeee27482c77666bbec515da
Christian Brabandt <cb@256bit.org>
parents: 8885
diff changeset
123 endfunc