1
0
forked from aniani/vim

patch 8.2.1065: Vim9: no line break allowed inside a list

Problem:    Vim9: no line break allowed inside a list.
Solution:   Handle line break inside a list in Vim9 script.
This commit is contained in:
Bram Moolenaar
2020-06-26 22:46:27 +02:00
parent e6536aa766
commit 7147820cb9
8 changed files with 69 additions and 30 deletions

View File

@@ -175,22 +175,25 @@ func Test_argument()
let save_columns = &columns
let &columns = 79
exe 'args ' .. join(range(1, 81))
call assert_equal(join([
\ '',
\ '[1] 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 ',
\ '2 7 12 17 22 27 32 37 42 47 52 57 62 67 72 77 ',
\ '3 8 13 18 23 28 33 38 43 48 53 58 63 68 73 78 ',
\ '4 9 14 19 24 29 34 39 44 49 54 59 64 69 74 79 ',
\ '5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 ',
\ ], "\n"),
\ execute('args'))
try
exe 'args ' .. join(range(1, 81))
call assert_equal(join([
\ '',
\ '[1] 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 ',
\ '2 7 12 17 22 27 32 37 42 47 52 57 62 67 72 77 ',
\ '3 8 13 18 23 28 33 38 43 48 53 58 63 68 73 78 ',
\ '4 9 14 19 24 29 34 39 44 49 54 59 64 69 74 79 ',
\ '5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 ',
\ ], "\n"),
\ execute('args'))
" No trailing newline with one item per row.
let long_arg = repeat('X', 81)
exe 'args ' .. long_arg
call assert_equal("\n[".long_arg.']', execute('args'))
let &columns = save_columns
" No trailing newline with one item per row.
let long_arg = repeat('X', 81)
exe 'args ' .. long_arg
call assert_equal("\n[".long_arg.']', execute('args'))
finally
let &columns = save_columns
endtry
" Setting argument list should fail when the current buffer has unsaved
" changes

View File

@@ -974,7 +974,7 @@ def Test_expr7_list()
" list
assert_equal(g:list_empty, [])
assert_equal(g:list_empty, [ ])
assert_equal(g:list_mixed, [1, 'b', false])
assert_equal(g:list_mixed, [1, 'b', false,])
assert_equal('b', g:list_mixed[1])
call CheckDefExecFailure(["let x = g:anint[3]"], 'E714:')
@@ -984,6 +984,26 @@ def Test_expr7_list()
call CheckDefExecFailure(["let x = g:list_empty[3]"], 'E684:')
enddef
def Test_expr7_list_vim9script()
let lines =<< trim END
vim9script
let l = [
11,
22,
]
assert_equal([11, 22], l)
END
CheckScriptSuccess(lines)
lines =<< trim END
vim9script
let l = [11,
22]
assert_equal([11, 22], l)
END
CheckScriptSuccess(lines)
enddef
def Test_expr7_lambda()
" lambda
let La = { -> 'result'}