aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/mason-core/installer/installer_spec.lua23
-rw-r--r--tests/mason-core/installer/linker_spec.lua4
2 files changed, 21 insertions, 6 deletions
diff --git a/tests/mason-core/installer/installer_spec.lua b/tests/mason-core/installer/installer_spec.lua
index 1092ebd1..094129f9 100644
--- a/tests/mason-core/installer/installer_spec.lua
+++ b/tests/mason-core/installer/installer_spec.lua
@@ -1,4 +1,3 @@
-local stub = require "luassert.stub"
local spy = require "luassert.spy"
local match = require "luassert.match"
local stub = require "luassert.stub"
@@ -64,8 +63,20 @@ describe("installer", function()
---@param ctx InstallContext
handler.package.spec.install = function(ctx)
ctx.receipt:with_primary_source { type = "source", metadata = {} }
- ctx.fs:write_file("target", "script-contents")
- ctx:link_bin("executable", "target")
+
+ ctx.fs:write_file("target", "")
+ ctx.fs:write_file("file.jar", "")
+ ctx.fs:write_file("opt-cmd", "")
+
+ ctx.links.bin = {
+ ["executable"] = "target",
+ }
+ ctx.links.share = {
+ ["package/file.jar"] = "file.jar",
+ }
+ ctx.links.opt = {
+ ["package/bin/opt-cmd"] = "opt-cmd",
+ }
end
installer.execute(handler, {})
assert.spy(fs.async.write_file).was_called_with(
@@ -77,7 +88,11 @@ describe("installer", function()
assert.same({ type = "source", metadata = {} }, receipt.primary_source)
assert.same({}, receipt.secondary_sources)
assert.same("1.1", receipt.schema_version)
- assert.same({ bin = { executable = "target" }, share = {} }, receipt.links)
+ assert.same({
+ bin = { executable = "target" },
+ share = { ["package/file.jar"] = "file.jar" },
+ opt = { ["package/bin/opt-cmd"] = "opt-cmd" },
+ }, receipt.links)
end)
)
end)
diff --git a/tests/mason-core/installer/linker_spec.lua b/tests/mason-core/installer/linker_spec.lua
index 57dba607..cf8260c6 100644
--- a/tests/mason-core/installer/linker_spec.lua
+++ b/tests/mason-core/installer/linker_spec.lua
@@ -129,8 +129,8 @@ describe("linker", function()
local handle = InstallHandleGenerator "dummy"
local ctx = InstallContextGenerator(handle)
- ctx:link_share("nested/path/share-file", path.concat { "nested", "path", "to", "share-file" })
- ctx:link_share("share-file", "share-file")
+ ctx.links.share["nested/path/share-file"] = path.concat { "nested", "path", "to", "share-file" }
+ ctx.links.share["share-file"] = "share-file"
assert.is_true(linker.link(ctx):is_success())
assert.spy(fs.async.write_file).was_called(0)