aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_let.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/testdir/test_let.vim')
-rw-r--r--src/nvim/testdir/test_let.vim55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_let.vim b/src/nvim/testdir/test_let.vim
index 8a6f1bc320..9887fb531e 100644
--- a/src/nvim/testdir/test_let.vim
+++ b/src/nvim/testdir/test_let.vim
@@ -140,3 +140,58 @@ func Test_let_varg_fail()
call assert_fails('call s:set_varg7(1)', 'E742:')
call s:set_varg8([0])
endfunction
+
+
+" Test for the setting a variable using the heredoc syntax
+func Test_let_heredoc()
+ let var1 =<< END
+Some sample text
+ Text with indent
+ !@#$%^&*()-+_={}|[]\~`:";'<>?,./
+END
+
+ call assert_equal(["Some sample text", "\tText with indent", " !@#$%^&*()-+_={}|[]\\~`:\";'<>?,./"], var1)
+
+ let var2 =<<
+Editor
+.
+ call assert_equal(['Editor'], var2)
+
+ let var3 =<<END
+END
+ call assert_equal([], var3)
+
+ let var3 =<<END
+vim
+
+end
+ END
+END
+END
+ call assert_equal(['vim', '', 'end', ' END', 'END '], var3)
+
+ let var1 =<< trim END
+ Line1
+ Line2
+ Line3
+ END
+ END
+ call assert_equal(['Line1', ' Line2', "\tLine3", ' END'], var1)
+
+ let var1 =<< trim
+ Line1
+ .
+ call assert_equal([' Line1'], var1)
+
+ call assert_fails('let v =<< marker', 'E991:')
+ call assert_fails('call WrongSyntax()', 'E488:')
+ call assert_fails('call MissingEnd()', 'E990:')
+endfunc
+
+func WrongSyntax()
+ let fail =<< that there
+endfunc
+
+func MissingEnd()
+ let fail =<< END
+endfunc