aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/lua')
-rw-r--r--test/functional/lua/treesitter_spec.lua4
-rw-r--r--test/functional/lua/vim_spec.lua15
2 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/lua/treesitter_spec.lua b/test/functional/lua/treesitter_spec.lua
index 0e823426ae..f34cbbb65b 100644
--- a/test/functional/lua/treesitter_spec.lua
+++ b/test/functional/lua/treesitter_spec.lua
@@ -22,6 +22,10 @@ describe('treesitter API', function()
matches("Error executing lua: Failed to load parser: uv_dlopen: .+",
pcall_err(exec_lua, "parser = vim.treesitter.require_language('borklang', 'borkbork.so')"))
+ -- Should not throw an error when silent
+ eq(false, exec_lua("return vim.treesitter.require_language('borklang', nil, true)"))
+ eq(false, exec_lua("return vim.treesitter.require_language('borklang', 'borkbork.so', true)"))
+
eq("Error executing lua: .../language.lua:0: no parser for 'borklang' language, see :help treesitter-parsers",
pcall_err(exec_lua, "parser = vim.treesitter.inspect_language('borklang')"))
end)
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index e9e1f7ec12..e253db5297 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -1453,3 +1453,18 @@ describe('lua stdlib', function()
end)
end)
end)
+
+describe('lua: require("mod") from packages', function()
+ before_each(function()
+ command('set rtp+=test/functional/fixtures')
+ end)
+
+ it('propagates syntax error', function()
+ local syntax_error_msg = exec_lua [[
+ local _, err = pcall(require, "syntax_error")
+ return err
+ ]]
+
+ matches("unexpected symbol", syntax_error_msg)
+ end)
+end)