diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-15 00:35:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 16:35:33 -0700 |
commit | 6188926e00081ae4b1a33d5fd12692a6749a2144 (patch) | |
tree | f8d12f0e0f4c1e22ca0df6824d276228fb7f7516 /test/functional/api/vim_spec.lua | |
parent | 9edd17509fca597b847656adc8fc20fc1cc44ce5 (diff) | |
download | rneovim-6188926e00081ae4b1a33d5fd12692a6749a2144.tar.gz rneovim-6188926e00081ae4b1a33d5fd12692a6749a2144.tar.bz2 rneovim-6188926e00081ae4b1a33d5fd12692a6749a2144.zip |
fix(:source, nvim_exec): handle Vimscript line continuations #14809
Problem:
Anonymous :source (no args) and nvim_exec() don't support Vimscript line continuations.
Solution:
Factor out the concat logic into concat_continued_line() and a
CONCAT_CONTINUED_LINES macro for simple concatenations where lines are
fetched individually.
Closes #14807
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 9aad8a1319..b4b2e63fb0 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -117,6 +117,19 @@ describe('API', function() nvim('exec','autocmd BufAdd * :let x1 = "Hello"', false) nvim('command', 'new foo') eq('Hello', request('nvim_eval', 'g:x1')) + + -- Line continuations + nvim('exec', [[ + let abc = #{ + \ a: 1, + "\ b: 2, + \ c: 3 + \ }]], false) + eq({a = 1, c = 3}, request('nvim_eval', 'g:abc')) + + -- try no spaces before continuations to catch off-by-one error + nvim('exec', 'let ab = #{\n\\a: 98,\n"\\ b: 2\n\\}', false) + eq({a = 98}, request('nvim_eval', 'g:ab')) end) it('non-ASCII input', function() |