" Tests for Perl interface
source check.vim
+source shared.vim
CheckFeature perl
" FIXME: RunTest don't see any error when Perl abort...
perl @l = ('5' ..'7')
perl $curbuf->Append(0, @l)
call assert_equal(['5', '6', '7', '', '1', '2', '3', '4'], getline(1, '$'))
+
+ perl $curbuf->Append(0)
+ call assert_match('^Usage: VIBUF::Append(vimbuf, lnum, @lines) at .* line 1\.$',
+ \ GetMessages()[-1])
+
bwipe!
endfunc
perl $curbuf->Set(2, 'a', 'b', 'c')
perl $curbuf->Set(4, 'A', 'B', 'C')
call assert_equal(['1', 'a', 'b', 'A', 'B'], getline(1, '$'))
+
+ perl $curbuf->Set(0)
+ call assert_match('^Usage: VIBUF::Set(vimbuf, lnum, @lines) at .* line 1\.$',
+ \ GetMessages()[-1])
+
bwipe!
endfunc
perldo VIM::DoCommand("%d_")
bwipe!
+ " Check a Perl expression which gives an error.
+ new
+ call setline(1, 'one')
+ perldo 1/0
+ call assert_match('^Illegal division by zero at .* line 1\.$', GetMessages()[-1])
+ bwipe!
+
" Check switching to another buffer does not trigger ml_get error.
new
let wincount = winnr('$')
func Test_stdio()
redir =>l:out
perl << trim EOF
- VIM::Msg("&VIM::Msg");
+ VIM::Msg("VIM::Msg");
+ VIM::Msg("VIM::Msg Error", "Error");
print "STDOUT";
print STDERR "STDERR";
EOF
redir END
- call assert_equal(['&VIM::Msg', 'STDOUT', 'STDERR'], split(l:out, "\n"))
+ call assert_equal(['VIM::Msg', 'VIM::Msg Error', 'STDOUT', 'STDERR'], split(l:out, "\n"))
endfunc
" Run first to get a clean namespace