Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 21142:165cea61e974 v8.2.1122
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Commit: https://github.com/vim/vim/commit/442af2f89e29fb60790bffde2def9cd74a081780
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 3 21:09:52 2020 +0200
patch 8.2.1122: Vim9: line continuation in dict member not recognized
Problem: Vim9: line continuation in dict member not recognized.
Solution: Check for line continuation.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 03 Jul 2020 21:15:04 +0200 |
parents | 839ace6773aa |
children | 1561311249bb |
comparison
equal
deleted
inserted
replaced
21141:d745abd682f9 | 21142:165cea61e974 |
---|---|
1136 call CheckDefFailure(["let x = g:dict_one.#$!"], 'E1002:') | 1136 call CheckDefFailure(["let x = g:dict_one.#$!"], 'E1002:') |
1137 call CheckDefExecFailure(["let d: dict<any>", "echo d['a']"], 'E716:') | 1137 call CheckDefExecFailure(["let d: dict<any>", "echo d['a']"], 'E716:') |
1138 call CheckDefExecFailure(["let d: dict<number>", "d = g:list_empty"], 'E1029: Expected dict but got list') | 1138 call CheckDefExecFailure(["let d: dict<number>", "d = g:list_empty"], 'E1029: Expected dict but got list') |
1139 enddef | 1139 enddef |
1140 | 1140 |
1141 def Test_expr_member_vim9script() | |
1142 let lines =<< trim END | |
1143 vim9script | |
1144 let d = #{one: | |
1145 'one', | |
1146 two: 'two'} | |
1147 assert_equal('one', d.one) | |
1148 assert_equal('one', d | |
1149 .one) | |
1150 assert_equal('one', d[ | |
1151 'one' | |
1152 ]) | |
1153 END | |
1154 CheckScriptSuccess(lines) | |
1155 | |
1156 lines =<< trim END | |
1157 vim9script | |
1158 let l = [1, | |
1159 2, | |
1160 3, 4 | |
1161 ] | |
1162 assert_equal(2, l[ | |
1163 1 | |
1164 ]) | |
1165 assert_equal([2, 3], l[1 : 2]) | |
1166 assert_equal([1, 2, 3], l[ | |
1167 : | |
1168 2 | |
1169 ]) | |
1170 assert_equal([3, 4], l[ | |
1171 2 | |
1172 : | |
1173 ]) | |
1174 END | |
1175 CheckScriptSuccess(lines) | |
1176 enddef | |
1177 | |
1141 def Test_expr7_option() | 1178 def Test_expr7_option() |
1142 " option | 1179 " option |
1143 set ts=11 | 1180 set ts=11 |
1144 assert_equal(11, &ts) | 1181 assert_equal(11, &ts) |
1145 &ts = 9 | 1182 &ts = 9 |