aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_perl.vim12
-rw-r--r--test/old/testdir/test_python2.vim19
-rw-r--r--test/old/testdir/test_python3.vim33
-rw-r--r--test/old/testdir/test_pyx2.vim27
-rw-r--r--test/old/testdir/test_pyx3.vim27
-rw-r--r--test/old/testdir/test_ruby.vim27
6 files changed, 123 insertions, 22 deletions
diff --git a/test/old/testdir/test_perl.vim b/test/old/testdir/test_perl.vim
index 558d0a5d6b..5cef74193b 100644
--- a/test/old/testdir/test_perl.vim
+++ b/test/old/testdir/test_perl.vim
@@ -224,11 +224,11 @@ endfunc
func Test_stdio()
throw 'skipped: TODO: '
redir =>l:out
- perl <<EOF
+ perl << trim EOF
VIM::Msg("&VIM::Msg");
print "STDOUT";
print STDERR "STDERR";
-EOF
+ EOF
redir END
call assert_equal(['&VIM::Msg', 'STDOUT', 'STDERR'], split(l:out, "\n"))
endfunc
@@ -305,7 +305,13 @@ END
perl <<
VIM::DoCommand('let s ..= "B"')
.
- call assert_equal('AB', s)
+ perl << trim END
+ VIM::DoCommand('let s ..= "C"')
+ END
+ perl << trim
+ VIM::DoCommand('let s ..= "D"')
+ .
+ call assert_equal('ABCD', s)
endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_python2.vim b/test/old/testdir/test_python2.vim
index ab03408fc4..f0259be70d 100644
--- a/test/old/testdir/test_python2.vim
+++ b/test/old/testdir/test_python2.vim
@@ -171,3 +171,22 @@ func Test_Catch_Exception_Message()
call assert_match('^Vim(.*):.*RuntimeError: TEST$', v:exception )
endtry
endfunc
+
+" Test for various heredoc syntax
+func Test_python_heredoc()
+ python << END
+s='A'
+END
+ python <<
+s+='B'
+.
+ python << trim END
+ s+='C'
+ END
+ python << trim
+ s+='D'
+ .
+ call assert_equal('ABCD', pyxeval('s'))
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_python3.vim b/test/old/testdir/test_python3.vim
index 6c9676603f..60773c5b2a 100644
--- a/test/old/testdir/test_python3.vim
+++ b/test/old/testdir/test_python3.vim
@@ -227,9 +227,11 @@ func Test_python3_opt_reset_local_to_global()
" Set the global and buffer-local option values and then clear the
" buffer-local option value.
for opt in bopts
- py3 pyopt = vim.bindeval("opt")
- py3 vim.options[pyopt[0]] = pyopt[1]
- py3 curbuf.options[pyopt[0]] = pyopt[2]
+ py3 << trim END
+ pyopt = vim.bindeval("opt")
+ vim.options[pyopt[0]] = pyopt[1]
+ curbuf.options[pyopt[0]] = pyopt[2]
+ END
exe "call assert_equal(opt[2], &" .. opt[0] .. ")"
exe "call assert_equal(opt[1], &g:" .. opt[0] .. ")"
exe "call assert_equal(opt[2], &l:" .. opt[0] .. ")"
@@ -247,9 +249,11 @@ func Test_python3_opt_reset_local_to_global()
\ ['sidescrolloff', 6, 12, -1],
\ ['statusline', '%<%f', '%<%F', '']]
for opt in wopts
- py3 pyopt = vim.bindeval("opt")
- py3 vim.options[pyopt[0]] = pyopt[1]
- py3 curwin.options[pyopt[0]] = pyopt[2]
+ py3 << trim
+ pyopt = vim.bindeval("opt")
+ vim.options[pyopt[0]] = pyopt[1]
+ curwin.options[pyopt[0]] = pyopt[2]
+ .
exe "call assert_equal(opt[2], &" .. opt[0] .. ")"
exe "call assert_equal(opt[1], &g:" .. opt[0] .. ")"
exe "call assert_equal(opt[2], &l:" .. opt[0] .. ")"
@@ -263,4 +267,21 @@ func Test_python3_opt_reset_local_to_global()
close!
endfunc
+" Test for various heredoc syntax
+func Test_python3_heredoc()
+ python3 << END
+s='A'
+END
+ python3 <<
+s+='B'
+.
+ python3 << trim END
+ s+='C'
+ END
+ python3 << trim
+ s+='D'
+ .
+ call assert_equal('ABCD', pyxeval('s'))
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_pyx2.vim b/test/old/testdir/test_pyx2.vim
index eee825fa9b..c7583d0234 100644
--- a/test/old/testdir/test_pyx2.vim
+++ b/test/old/testdir/test_pyx2.vim
@@ -15,10 +15,10 @@ endfunc
func Test_pyx()
redir => var
- pyx << EOF
-import sys
-print(sys.version)
-EOF
+ pyx << trim EOF
+ import sys
+ print(sys.version)
+ EOF
redir END
call assert_match(s:py2pattern, split(var)[0])
endfunc
@@ -79,3 +79,22 @@ func Test_Catch_Exception_Message()
call assert_match('^Vim(.*):.*RuntimeError: TEST$', v:exception )
endtry
endfunc
+
+" Test for various heredoc syntaxes
+func Test_pyx2_heredoc()
+ pyx << END
+result='A'
+END
+ pyx <<
+result+='B'
+.
+ pyx << trim END
+ result+='C'
+ END
+ pyx << trim
+ result+='D'
+ .
+ call assert_equal('ABCD', pyxeval('result'))
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_pyx3.vim b/test/old/testdir/test_pyx3.vim
index db39f5134a..a4666fe3d4 100644
--- a/test/old/testdir/test_pyx3.vim
+++ b/test/old/testdir/test_pyx3.vim
@@ -15,10 +15,10 @@ endfunc
func Test_pyx()
redir => var
- pyx << EOF
-import sys
-print(sys.version)
-EOF
+ pyx << trim EOF
+ import sys
+ print(sys.version)
+ EOF
redir END
call assert_match(s:py3pattern, split(var)[0])
endfunc
@@ -79,3 +79,22 @@ func Test_Catch_Exception_Message()
call assert_match('^Vim(.*):.*RuntimeError: TEST$', v:exception )
endtry
endfunc
+
+" Test for various heredoc syntaxes
+func Test_pyx3_heredoc()
+ pyx << END
+result='A'
+END
+ pyx <<
+result+='B'
+.
+ pyx << trim END
+ result+='C'
+ END
+ pyx << trim
+ result+='D'
+ .
+ call assert_equal('ABCD', pyxeval('result'))
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_ruby.vim b/test/old/testdir/test_ruby.vim
index 1fbf3392d9..80d39309ea 100644
--- a/test/old/testdir/test_ruby.vim
+++ b/test/old/testdir/test_ruby.vim
@@ -341,11 +341,11 @@ func Test_ruby_Vim_evaluate_list()
call setline(line('$'), ['2 line 2'])
ruby Vim.command("normal /^2\n")
let l = ["abc", "def"]
- ruby << EOF
- curline = $curbuf.line_number
- l = Vim.evaluate("l");
- $curbuf.append(curline, l.join("|"))
-EOF
+ ruby << trim EOF
+ curline = $curbuf.line_number
+ l = Vim.evaluate("l");
+ $curbuf.append(curline, l.join("|"))
+ EOF
normal j
.rubydo $_ = $_.gsub(/\|/, '/')
call assert_equal('abc/def', getline('$'))
@@ -414,4 +414,21 @@ func Test_rubyeval_error()
call assert_fails('call rubyeval("(")')
endfunc
+" Test for various heredoc syntax
+func Test_ruby_heredoc()
+ ruby << END
+Vim.command('let s = "A"')
+END
+ ruby <<
+Vim.command('let s ..= "B"')
+.
+ ruby << trim END
+ Vim.command('let s ..= "C"')
+ END
+ ruby << trim
+ Vim.command('let s ..= "D"')
+ .
+ call assert_equal('ABCD', s)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab