Compare commits
2 Commits
59a963a5c5
...
318a86d786
Author | SHA1 | Date | |
---|---|---|---|
318a86d786
|
|||
5541a656e2
|
@ -184,10 +184,7 @@ function spec:check(silent)
|
||||
return false
|
||||
end
|
||||
|
||||
-- turn an id into a spec
|
||||
if (is == "string") then
|
||||
self.reqs = { self.reqs }
|
||||
end
|
||||
self.reqs = spec.correct_spec(self.reqs)
|
||||
end
|
||||
|
||||
if self.deps ~= nil then -- spec.deps
|
||||
@ -197,10 +194,7 @@ function spec:check(silent)
|
||||
return false
|
||||
end
|
||||
|
||||
-- turn an id into a spec
|
||||
if (is == "string") then
|
||||
self.deps = { self.deps }
|
||||
end
|
||||
self.deps = spec.correct_spec(self.deps)
|
||||
end
|
||||
|
||||
if silent == true then
|
||||
|
@ -1,5 +1,6 @@
|
||||
---@diagnostic disable: undefined-global, undefined-field
|
||||
local dep_ui_format = require("dep.ui.format")
|
||||
local dep_spec_man = require("dep.spec")
|
||||
|
||||
describe("ui log formatting", function()
|
||||
it("returns the proper chunks to print a formatted line", function()
|
||||
@ -18,3 +19,52 @@ describe("ui log formatting", function()
|
||||
)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("package specification", function()
|
||||
it("gets the package's name", function()
|
||||
assert.equal(dep_spec_man.get_name({ "user/package" }), "package")
|
||||
assert.equal(dep_spec_man.get_name({ "user/package.git" }), "package.git")
|
||||
end)
|
||||
|
||||
it("ensurses specs are in the proper format", function()
|
||||
local correct = { "user/package" }
|
||||
assert.same(dep_spec_man.correct_spec("user/package"), correct)
|
||||
assert.same(dep_spec_man.correct_spec({ "user/package" }), correct)
|
||||
assert.same(dep_spec_man.correct_spec({ { "user/package" } }), correct)
|
||||
end)
|
||||
|
||||
it("checks a spec for correctness", function()
|
||||
assert.same(
|
||||
dep_spec_man.check({ "user/package" }, true),
|
||||
{ "user/package" }
|
||||
)
|
||||
|
||||
assert.same(
|
||||
dep_spec_man.check({
|
||||
"user/package",
|
||||
deps = "user/dependency"
|
||||
}, true),
|
||||
{
|
||||
"user/package",
|
||||
deps = {
|
||||
"user/dependency"
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
assert.same(
|
||||
dep_spec_man.check({
|
||||
"user/package",
|
||||
deps = {
|
||||
{ { "user/dependency" } }
|
||||
}
|
||||
}, true),
|
||||
{
|
||||
"user/package",
|
||||
deps = {
|
||||
"user/dependency"
|
||||
}
|
||||
}
|
||||
)
|
||||
end)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user