aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mason-core
diff options
context:
space:
mode:
authorMark Sommers <42284859+marks0mmers@users.noreply.github.com>2025-02-15 10:44:40 -0500
committerGitHub <noreply@github.com>2025-02-15 16:44:40 +0100
commit5664dd5deb3ac9527da90691543eb28df51c1ef8 (patch)
tree4f7f8857c4ef6abc26ed2412d84cf28edc0f6635 /tests/mason-core
parenttests: add new nvim versions to test matrix (#1877) (diff)
downloadmason-5664dd5deb3ac9527da90691543eb28df51c1ef8.tar
mason-5664dd5deb3ac9527da90691543eb28df51c1ef8.tar.gz
mason-5664dd5deb3ac9527da90691543eb28df51c1ef8.tar.bz2
mason-5664dd5deb3ac9527da90691543eb28df51c1ef8.tar.lz
mason-5664dd5deb3ac9527da90691543eb28df51c1ef8.tar.xz
mason-5664dd5deb3ac9527da90691543eb28df51c1ef8.tar.zst
mason-5664dd5deb3ac9527da90691543eb28df51c1ef8.zip
fix: replace deprecated calls to vim.validate (#1876)
Co-authored-by: William Boman <william@redwill.se>
Diffstat (limited to 'tests/mason-core')
-rw-r--r--tests/mason-core/package/package_spec.lua100
1 files changed, 51 insertions, 49 deletions
diff --git a/tests/mason-core/package/package_spec.lua b/tests/mason-core/package/package_spec.lua
index 0343d8bd..2cd47452 100644
--- a/tests/mason-core/package/package_spec.lua
+++ b/tests/mason-core/package/package_spec.lua
@@ -23,60 +23,62 @@ describe("package", function()
assert.same({ "rust-analyzer", "nightly" }, parse "rust-analyzer@nightly")
end)
- it("should validate spec", function()
- local valid_spec = {
- name = "Package name",
- desc = "Package description",
- homepage = "https://example.com",
- categories = { Pkg.Cat.LSP },
- languages = { Pkg.Lang.Rust },
- install = function() end,
- }
- local function spec(fields)
- return setmetatable(fields, { __index = valid_spec })
- end
- assert.equals(
- "name: expected string, got number",
- assert.has_error(function()
- Pkg.new(spec { name = 23 })
- end)
- )
+ if vim.fn.has "nvim-0.11" == 1 then
+ it("should validate spec", function()
+ local valid_spec = {
+ name = "Package name",
+ desc = "Package description",
+ homepage = "https://example.com",
+ categories = { Pkg.Cat.LSP },
+ languages = { Pkg.Lang.Rust },
+ install = function() end,
+ }
+ local function spec(fields)
+ return setmetatable(fields, { __index = valid_spec })
+ end
+ assert.equals(
+ "name: expected string, got number",
+ assert.has_error(function()
+ Pkg.new(spec { name = 23 })
+ end)
+ )
- assert.equals(
- "desc: expected string, got number",
- assert.has_error(function()
- Pkg.new(spec { desc = 23 })
- end)
- )
+ assert.equals(
+ "desc: expected string, got number",
+ assert.has_error(function()
+ Pkg.new(spec { desc = 23 })
+ end)
+ )
- assert.equals(
- "homepage: expected string, got number",
- assert.has_error(function()
- Pkg.new(spec { homepage = 23 })
- end)
- )
+ assert.equals(
+ "homepage: expected string, got number",
+ assert.has_error(function()
+ Pkg.new(spec { homepage = 23 })
+ end)
+ )
- assert.equals(
- "categories: expected table, got number",
- assert.has_error(function()
- Pkg.new(spec { categories = 23 })
- end)
- )
+ assert.equals(
+ "categories: expected table, got number",
+ assert.has_error(function()
+ Pkg.new(spec { categories = 23 })
+ end)
+ )
- assert.equals(
- "languages: expected table, got number",
- assert.has_error(function()
- Pkg.new(spec { languages = 23 })
- end)
- )
+ assert.equals(
+ "languages: expected table, got number",
+ assert.has_error(function()
+ Pkg.new(spec { languages = 23 })
+ end)
+ )
- assert.equals(
- "install: expected function, got number",
- assert.has_error(function()
- Pkg.new(spec { install = 23 })
- end)
- )
- end)
+ assert.equals(
+ "install: expected function, got number",
+ assert.has_error(function()
+ Pkg.new(spec { install = 23 })
+ end)
+ )
+ end)
+ end
it("should create new handle", function()
local dummy = registry.get_package "dummy"