vim-patch:8.1.1354: getting a list of text lines is clumsy

Problem:    Getting a list of text lines is clumsy.
Solution:   Add the =<< assignment. (Yegappan Lakshmanan, closes vim/vim#4386)
f5842c5a53
This commit is contained in:
Jurica Bradaric
2019-09-22 21:47:24 +02:00
parent dfed0e60d7
commit b1ada8ec21
3 changed files with 185 additions and 0 deletions

View File

@@ -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