diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mason-registry/registry_spec.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/mason-registry/registry_spec.lua b/tests/mason-registry/registry_spec.lua new file mode 100644 index 00000000..5931ca35 --- /dev/null +++ b/tests/mason-registry/registry_spec.lua @@ -0,0 +1,20 @@ +local Pkg = require "mason-core.package" +local registry = require "mason-registry" + +describe("mason-registry", function() + it("should return package", function() + assert.is_true(getmetatable(registry.get_package "dummy").__index == Pkg) + end) + + it("should error when getting non-existent package", function() + local err = assert.has_error(function() + registry.get_package "non-existent" + end) + assert.equals([[Cannot find package "non-existent".]], err) + end) + + it("should check whether package exists", function() + assert.is_true(registry.has_package "dummy") + assert.is_false(registry.has_package "non-existent") + end) +end) |
