diff options
author | ZyX <kp-pav@yandex.ru> | 2017-10-15 19:18:17 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-10-15 19:18:17 +0300 |
commit | 206f7ae76a4a06c6bac10402649e515dd3fb2365 (patch) | |
tree | ce86173b64976a282ea32fd15497402d6fbd4a52 /test/unit/viml/expressions/parser_spec.lua | |
parent | c286155bfa53c828ebe5479fd81a544740a92403 (diff) | |
download | rneovim-206f7ae76a4a06c6bac10402649e515dd3fb2365.tar.gz rneovim-206f7ae76a4a06c6bac10402649e515dd3fb2365.tar.bz2 rneovim-206f7ae76a4a06c6bac10402649e515dd3fb2365.zip |
unittests: Test some edge cases
Diffstat (limited to 'test/unit/viml/expressions/parser_spec.lua')
-rw-r--r-- | test/unit/viml/expressions/parser_spec.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/unit/viml/expressions/parser_spec.lua b/test/unit/viml/expressions/parser_spec.lua index d95eaca79b..407114ff33 100644 --- a/test/unit/viml/expressions/parser_spec.lua +++ b/test/unit/viml/expressions/parser_spec.lua @@ -4241,6 +4241,40 @@ describe('Expressions parser', function() hl('UnaryPlus', '+', 1), hl('Identifier', 'b'), }) + + check_parsing('a. b', 0, { + -- 0123 + ast = { + { + 'Concat:0:1:.', + children = { + 'PlainIdentifier(scope=0,ident=a):0:0:a', + 'PlainIdentifier(scope=0,ident=b):0:2: b', + }, + }, + }, + }, { + hl('Identifier', 'a'), + hl('ConcatOrSubscript', '.'), + hl('Identifier', 'b', 1), + }) + + check_parsing('a. 1', 0, { + -- 0123 + ast = { + { + 'Concat:0:1:.', + children = { + 'PlainIdentifier(scope=0,ident=a):0:0:a', + 'Integer(val=1):0:2: 1', + }, + }, + }, + }, { + hl('Identifier', 'a'), + hl('ConcatOrSubscript', '.'), + hl('Number', '1', 1), + }) end) itp('works with bracket subscripts', function() check_parsing(':', 0, { @@ -6823,4 +6857,14 @@ describe('Expressions parser', function() hl('Number', '2'), }) end) + itp('works (KLEE tests)', function() + check_parsing('\0002&A:\000', 0, { + ast = nil, + err = { + arg = '', + msg = 'E15: Expected value, got EOC: %.*s', + }, + }, { + }) + end) end) |