aboutsummaryrefslogtreecommitdiff
path: root/test/unit/viml/expressions/parser_tests.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-11-26 16:57:42 +0300
committerZyX <kp-pav@yandex.ru>2017-11-26 16:57:42 +0300
commit36a4f3a259ffa282129b18358cce4130397077c5 (patch)
tree7f541df36335de5a578e978e1335857d6b823935 /test/unit/viml/expressions/parser_tests.lua
parentcddf84c3982b8225f1592b6a61b63f8d1883ca94 (diff)
downloadrneovim-36a4f3a259ffa282129b18358cce4130397077c5.tar.gz
rneovim-36a4f3a259ffa282129b18358cce4130397077c5.tar.bz2
rneovim-36a4f3a259ffa282129b18358cce4130397077c5.zip
viml/parser/expressions: Make sure that listed nodes may be present
With the new test leaving `assert(false);` for any of the cases makes tests crash.
Diffstat (limited to 'test/unit/viml/expressions/parser_tests.lua')
-rw-r--r--test/unit/viml/expressions/parser_tests.lua44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/unit/viml/expressions/parser_tests.lua b/test/unit/viml/expressions/parser_tests.lua
index 4700b6ee42..e085d7e932 100644
--- a/test/unit/viml/expressions/parser_tests.lua
+++ b/test/unit/viml/expressions/parser_tests.lua
@@ -4228,6 +4228,50 @@ return function(itp, _check_parsing, hl, fmtn)
hl('ConcatOrSubscript', '.'),
hl('Number', '1', 1),
})
+
+ check_parsing('a[1][2][3[4', {
+ -- 01234567890
+ -- 0 1
+ ast = {
+ {
+ 'Subscript:0:7:[',
+ children = {
+ {
+ 'Subscript:0:4:[',
+ children = {
+ {
+ 'Subscript:0:1:[',
+ children = {
+ 'PlainIdentifier(scope=0,ident=a):0:0:a',
+ 'Integer(val=1):0:2:1',
+ },
+ },
+ 'Integer(val=2):0:5:2',
+ },
+ },
+ {
+ 'Subscript:0:9:[',
+ children = {
+ 'Integer(val=3):0:8:3',
+ 'Integer(val=4):0:10:4',
+ },
+ },
+ },
+ },
+ },
+ }, {
+ hl('IdentifierName', 'a'),
+ hl('SubscriptBracket', '['),
+ hl('Number', '1'),
+ hl('SubscriptBracket', ']'),
+ hl('SubscriptBracket', '['),
+ hl('Number', '2'),
+ hl('SubscriptBracket', ']'),
+ hl('SubscriptBracket', '['),
+ hl('Number', '3'),
+ hl('SubscriptBracket', '['),
+ hl('Number', '4'),
+ })
end)
itp('works with bracket subscripts', function()
check_parsing(':', {