aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/source_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2021-06-23 20:34:57 +0200
committerGitHub <noreply@github.com>2021-06-23 20:34:57 +0200
commit24e0c16fd6cb33a399772330cb80dfa4c1306284 (patch)
tree01f7f2c30dd159bc03b5ebc8ae9ed8b2b7d1c61e /test/functional/ex_cmds/source_spec.lua
parent0d7e33bc1307117127e519fb12ec491a1a1ebd82 (diff)
parentb4ac8780267d9164a84deaec27fbc6260f765514 (diff)
downloadrneovim-24e0c16fd6cb33a399772330cb80dfa4c1306284.tar.gz
rneovim-24e0c16fd6cb33a399772330cb80dfa4c1306284.tar.bz2
rneovim-24e0c16fd6cb33a399772330cb80dfa4c1306284.zip
Merge pull request #14868 from shadmansaleh/patch_verbose_for_lua
fix(runtime): Fix bugs regarding lua runtime files
Diffstat (limited to 'test/functional/ex_cmds/source_spec.lua')
-rw-r--r--test/functional/ex_cmds/source_spec.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua
index a03e1ae9ce..37c97f519a 100644
--- a/test/functional/ex_cmds/source_spec.lua
+++ b/test/functional/ex_cmds/source_spec.lua
@@ -9,6 +9,8 @@ local feed_command = helpers.feed_command
local write_file = helpers.write_file
local exec = helpers.exec
local eval = helpers.eval
+local exec_capture = helpers.exec_capture
+local neq = helpers.neq
describe(':source', function()
before_each(function()
@@ -90,4 +92,27 @@ describe(':source', function()
eq(12, eval('g:c'))
os.remove(test_file)
end)
+
+ it("doesn't throw E484 for lua parsing/runtime errors", function()
+ local test_file = 'test.lua'
+
+ -- Does throw E484 for unreadable files
+ local ok, result = pcall(exec_capture, ":source "..test_file ..'noexisting')
+ eq(false, ok)
+ neq(nil, result:find("E484"))
+
+ -- Doesn't throw for parsing error
+ write_file (test_file, "vim.g.c = ")
+ ok, result = pcall(exec_capture, ":source "..test_file)
+ eq(false, ok)
+ eq(nil, result:find("E484"))
+ os.remove(test_file)
+
+ -- Doesn't throw for runtime error
+ write_file (test_file, "error('Cause error anyway :D')")
+ ok, result = pcall(exec_capture, ":source "..test_file)
+ eq(false, ok)
+ eq(nil, result:find("E484"))
+ os.remove(test_file)
+ end)
end)