From e6d77993d1167f4c15c9f67c0c3281444b1d18c2 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 4 Aug 2019 19:42:31 +0200 Subject: lua: do not crash on syntax error in debug.debug() --- test/functional/lua/overrides_spec.lua | 75 ++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) (limited to 'test/functional/lua/overrides_spec.lua') diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua index c0541eeae9..f6439001ac 100644 --- a/test/functional/lua/overrides_spec.lua +++ b/test/functional/lua/overrides_spec.lua @@ -207,6 +207,81 @@ describe('debug.debug', function() {cr:Press ENTER or type command to continue}^ | ]]) end) + + it("can be safely exited with 'cont'", function() + feed('') + feed(':lua debug.debug() print("x")') + screen:expect{grid=[[ + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + lua_debug> ^ | + ]]} + + feed("conttt") -- misspelled cont; invalid syntax + screen:expect{grid=[[ + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + lua_debug> conttt | + {E:E5115: Error while loading debug string: (debug comma}| + {E:nd):1: '=' expected near ''} | + lua_debug> ^ | + ]]} + + feed("cont") -- exactly "cont", exit now + screen:expect{grid=[[ + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + lua_debug> conttt | + {E:E5115: Error while loading debug string: (debug comma}| + {E:nd):1: '=' expected near ''} | + lua_debug> cont | + x | + {cr:Press ENTER or type command to continue}^ | + ]]} + + feed('') + screen:expect{grid=[[ + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]} + end) end) describe('package.path/package.cpath', function() -- cgit