aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/overrides_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-01-30 03:30:45 +0300
committerZyX <kp-pav@yandex.ru>2017-03-27 00:18:54 +0300
commitd13fdfd4467db8245159d10d96c1f30b24b51565 (patch)
tree369d6ff561a11225a91e432b66c1991c4ad99e7c /test/functional/lua/overrides_spec.lua
parent73d37f8b6e9eba0d2f2c59694ae5a13777a7f1cd (diff)
downloadrneovim-d13fdfd4467db8245159d10d96c1f30b24b51565.tar.gz
rneovim-d13fdfd4467db8245159d10d96c1f30b24b51565.tar.bz2
rneovim-d13fdfd4467db8245159d10d96c1f30b24b51565.zip
functests: Add test for debug.debug
Diffstat (limited to 'test/functional/lua/overrides_spec.lua')
-rw-r--r--test/functional/lua/overrides_spec.lua111
1 files changed, 111 insertions, 0 deletions
diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua
index 92167d18dc..60a0589b48 100644
--- a/test/functional/lua/overrides_spec.lua
+++ b/test/functional/lua/overrides_spec.lua
@@ -1,8 +1,10 @@
-- Test for Vim overrides of lua built-ins
local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
local eq = helpers.eq
local NIL = helpers.NIL
+local feed = helpers.feed
local clear = helpers.clear
local funcs = helpers.funcs
local meths = helpers.meths
@@ -10,6 +12,8 @@ local command = helpers.command
local write_file = helpers.write_file
local redir_exec = helpers.redir_exec
+local screen
+
local fname = 'Xtest-functional-lua-overrides-luafile'
before_each(clear)
@@ -63,3 +67,110 @@ describe('print', function()
eq('\nT\n', redir_exec([[lua print("T\n")]]))
end)
end)
+
+describe('debug.debug', function()
+ before_each(function()
+ screen = Screen.new()
+ screen:attach()
+ screen:set_default_attr_ids({
+ [0] = {bold=true, foreground=255},
+ E = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ cr = {bold = true, foreground = Screen.colors.SeaGreen4},
+ })
+ end)
+ it('works', function()
+ write_file(fname, [[
+ function Test(a)
+ print(a)
+ debug.debug()
+ print(a * 100)
+ end
+ ]])
+ eq('', redir_exec('luafile ' .. fname))
+ feed(':lua Test()\n')
+ screen:expect([[
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ nil |
+ lua_debug> ^ |
+ ]])
+ feed('print("TEST")\n')
+ screen:expect([[
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ nil |
+ lua_debug> print("TEST") |
+ TEST |
+ lua_debug> ^ |
+ ]])
+ feed('<C-c>')
+ screen:expect([[
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ nil |
+ lua_debug> print("TEST") |
+ TEST |
+ |
+ {E:E5105: Error while calling lua chunk: Xtest-functiona}|
+ {E:l-lua-overrides-luafile:4: attempt to perform arithme}|
+ {E:tic on local 'a' (a nil value)} |
+ Interrupt: {cr:Press ENTER or type command to continue}^ |
+ ]])
+ feed('<C-l>:lua Test()\n')
+ screen:expect([[
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ nil |
+ lua_debug> ^ |
+ ]])
+ feed('\n')
+ screen:expect([[
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ nil |
+ lua_debug> |
+ {E:E5105: Error while calling lua chunk: Xtest-functiona}|
+ {E:l-lua-overrides-luafile:4: attempt to perform arithme}|
+ {E:tic on local 'a' (a nil value)} |
+ {cr:Press ENTER or type command to continue}^ |
+ ]])
+ end)
+end)