diff options
| author | William Boman <william@redwill.se> | 2023-01-04 07:28:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-04 07:28:35 +0100 |
| commit | 2100324ec2ed6b2b0770f8954f1dd1c02484f2cf (patch) | |
| tree | f3c8bd65d5e749115b90b851a6ba539df9224f98 /tests/mason-registry/registry_spec.lua | |
| parent | fix(mason-registry): don't pass possible nil value to log (#840) (diff) | |
| download | mason-2100324ec2ed6b2b0770f8954f1dd1c02484f2cf.tar mason-2100324ec2ed6b2b0770f8954f1dd1c02484f2cf.tar.gz mason-2100324ec2ed6b2b0770f8954f1dd1c02484f2cf.tar.bz2 mason-2100324ec2ed6b2b0770f8954f1dd1c02484f2cf.tar.lz mason-2100324ec2ed6b2b0770f8954f1dd1c02484f2cf.tar.xz mason-2100324ec2ed6b2b0770f8954f1dd1c02484f2cf.tar.zst mason-2100324ec2ed6b2b0770f8954f1dd1c02484f2cf.zip | |
feat(registry): add has_package() method (#847)
Diffstat (limited to 'tests/mason-registry/registry_spec.lua')
| -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) |
