aboutsummaryrefslogtreecommitdiff
path: root/test/unit/viml/expressions/parser_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-10-19 10:48:05 +0300
committerZyX <kp-pav@yandex.ru>2017-10-19 10:48:05 +0300
commit47938e1e22816381f26e8882eacd6e7e8baf37fd (patch)
treec48b26968a664cbfe12790445efaa95761109ffc /test/unit/viml/expressions/parser_spec.lua
parent895793fc820e04ea2d6bdaa90c6643c4dce2f0e7 (diff)
downloadrneovim-47938e1e22816381f26e8882eacd6e7e8baf37fd.tar.gz
rneovim-47938e1e22816381f26e8882eacd6e7e8baf37fd.tar.bz2
rneovim-47938e1e22816381f26e8882eacd6e7e8baf37fd.zip
viml/parser/expressions: Fix some errors spotted by KLEE
Not all of them are fixed yet though.
Diffstat (limited to 'test/unit/viml/expressions/parser_spec.lua')
-rw-r--r--test/unit/viml/expressions/parser_spec.lua139
1 files changed, 139 insertions, 0 deletions
diff --git a/test/unit/viml/expressions/parser_spec.lua b/test/unit/viml/expressions/parser_spec.lua
index 5f5924c630..b81a3c0f82 100644
--- a/test/unit/viml/expressions/parser_spec.lua
+++ b/test/unit/viml/expressions/parser_spec.lua
@@ -7006,5 +7006,144 @@ describe('Expressions parser', function()
hl('NumberPrefix', '0'),
hl('Number', '0'),
})
+ check_parsing('"\\U\\', 0, {
+ -- 0123
+ ast = {
+ [[DoubleQuotedString(val="U\\"):0:0:"\U\]],
+ },
+ err = {
+ arg = '"\\U\\',
+ msg = 'E114: Missing double quote: %.*s',
+ },
+ }, {
+ hl('InvalidDoubleQuotedString', '"'),
+ hl('InvalidDoubleQuotedUnknownEscape', '\\U'),
+ hl('InvalidDoubleQuotedBody', '\\'),
+ })
+ check_parsing('"\\U', 0, {
+ -- 012
+ ast = {
+ 'DoubleQuotedString(val="U"):0:0:"\\U',
+ },
+ err = {
+ arg = '"\\U',
+ msg = 'E114: Missing double quote: %.*s',
+ },
+ }, {
+ hl('InvalidDoubleQuotedString', '"'),
+ hl('InvalidDoubleQuotedUnknownEscape', '\\U'),
+ })
+ check_parsing('|"\\U\\', 2, {
+ -- 01234
+ ast = {
+ {
+ 'Or:0:0:|',
+ children = {
+ 'Missing:0:0:',
+ 'DoubleQuotedString(val="U\\\\"):0:1:"\\U\\',
+ },
+ },
+ },
+ err = {
+ arg = '|"\\U\\',
+ msg = 'E15: Unexpected EOC character: %.*s',
+ },
+ }, {
+ hl('InvalidOr', '|'),
+ hl('InvalidDoubleQuotedString', '"'),
+ hl('InvalidDoubleQuotedUnknownEscape', '\\U'),
+ hl('InvalidDoubleQuotedBody', '\\'),
+ })
+ check_parsing('|"\\e"', 2, {
+ -- 01234
+ ast = {
+ {
+ 'Or:0:0:|',
+ children = {
+ 'Missing:0:0:',
+ 'DoubleQuotedString(val="\\27"):0:1:"\\e"',
+ },
+ },
+ },
+ err = {
+ arg = '|"\\e"',
+ msg = 'E15: Unexpected EOC character: %.*s',
+ },
+ }, {
+ hl('InvalidOr', '|'),
+ hl('DoubleQuotedString', '"'),
+ hl('DoubleQuotedEscape', '\\e'),
+ hl('DoubleQuotedString', '"'),
+ })
+ check_parsing('|\029', 2, {
+ -- 01
+ ast = {
+ {
+ 'Or:0:0:|',
+ children = {
+ 'Missing:0:0:',
+ 'PlainIdentifier(scope=0,ident=\029):0:1:\029',
+ },
+ },
+ },
+ err = {
+ arg = '|\029',
+ msg = 'E15: Unexpected EOC character: %.*s',
+ },
+ }, {
+ hl('InvalidOr', '|'),
+ hl('InvalidIdentifier', '\029'),
+ })
+ check_parsing('"\\<', 0, {
+ -- 012
+ ast = {
+ 'DoubleQuotedString(val="<"):0:0:"\\<',
+ },
+ err = {
+ arg = '"\\<',
+ msg = 'E114: Missing double quote: %.*s',
+ },
+ }, {
+ hl('InvalidDoubleQuotedString', '"'),
+ hl('InvalidDoubleQuotedUnknownEscape', '\\<'),
+ })
+ check_parsing('"\\1', 0, {
+ -- 012
+ ast = {
+ 'DoubleQuotedString(val="\\1"):0:0:"\\1',
+ },
+ err = {
+ arg = '"\\1',
+ msg = 'E114: Missing double quote: %.*s',
+ },
+ }, {
+ hl('InvalidDoubleQuotedString', '"'),
+ hl('InvalidDoubleQuotedEscape', '\\1'),
+ })
+ check_parsing('}l')
+ check_parsing(':?\000\000\000\000\000\000\000', 0, {
+ ast = {
+ {
+ 'Colon:0:0::',
+ children = {
+ 'Missing:0:0:',
+ {
+ 'Ternary:0:1:?',
+ children = {
+ 'Missing:0:1:',
+ 'TernaryValue:0:1:?',
+ },
+ },
+ },
+ },
+ },
+ err = {
+ arg = ':?',
+ msg = 'E15: Colon outside of dictionary or ternary operator: %.*s',
+ },
+ }, {
+ hl('InvalidColon', ':'),
+ hl('InvalidTernary', '?'),
+ })
end)
end)