зеркало из https://github.com/golang/dep.git
Migrate tests of dev deps
This commit is contained in:
Родитель
d17cee8f53
Коммит
9d646c308d
|
@ -71,8 +71,9 @@ func mksvd(info string) ProjectDep {
|
||||||
}
|
}
|
||||||
|
|
||||||
type depspec struct {
|
type depspec struct {
|
||||||
name ProjectAtom
|
name ProjectAtom
|
||||||
deps []ProjectDep
|
deps []ProjectDep
|
||||||
|
devdeps []ProjectDep
|
||||||
}
|
}
|
||||||
|
|
||||||
// dsv - "depspec semver" (make a semver depspec)
|
// dsv - "depspec semver" (make a semver depspec)
|
||||||
|
@ -90,7 +91,11 @@ func dsv(pi string, deps ...string) depspec {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, dep := range deps {
|
for _, dep := range deps {
|
||||||
ds.deps = append(ds.deps, mksvd(dep))
|
if strings.HasPrefix(dep, "(dev) ") {
|
||||||
|
ds.devdeps = append(ds.devdeps, mksvd(strings.TrimPrefix(dep, "(dev) ")))
|
||||||
|
} else {
|
||||||
|
ds.deps = append(ds.deps, mksvd(dep))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ds
|
return ds
|
||||||
|
@ -311,6 +316,44 @@ var fixtures = []fixture{
|
||||||
),
|
),
|
||||||
maxAttempts: 4,
|
maxAttempts: 4,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
n: "includes root package's dev dependencies",
|
||||||
|
ds: []depspec{
|
||||||
|
dsv("root 1.0.0", "(dev) foo 1.0.0", "(dev) bar 1.0.0"),
|
||||||
|
dsv("foo 1.0.0"),
|
||||||
|
dsv("bar 1.0.0"),
|
||||||
|
},
|
||||||
|
r: mkresults(
|
||||||
|
"root 1.0.0",
|
||||||
|
"foo 1.0.0",
|
||||||
|
"bar 1.0.0",
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
n: "includes dev dependency's transitive dependencies",
|
||||||
|
ds: []depspec{
|
||||||
|
dsv("root 1.0.0", "(dev) foo 1.0.0"),
|
||||||
|
dsv("foo 1.0.0", "bar 1.0.0"),
|
||||||
|
dsv("bar 1.0.0"),
|
||||||
|
},
|
||||||
|
r: mkresults(
|
||||||
|
"root 1.0.0",
|
||||||
|
"foo 1.0.0",
|
||||||
|
"bar 1.0.0",
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
n: "ignores transitive dependency's dev dependencies",
|
||||||
|
ds: []depspec{
|
||||||
|
dsv("root 1.0.0", "(dev) foo 1.0.0"),
|
||||||
|
dsv("foo 1.0.0", "(dev) bar 1.0.0"),
|
||||||
|
dsv("bar 1.0.0"),
|
||||||
|
},
|
||||||
|
r: mkresults(
|
||||||
|
"root 1.0.0",
|
||||||
|
"foo 1.0.0",
|
||||||
|
),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
type depspecSourceManager struct {
|
type depspecSourceManager struct {
|
||||||
|
@ -386,7 +429,7 @@ func (ds depspec) GetDependencies() []ProjectDep {
|
||||||
|
|
||||||
// impl Spec interface
|
// impl Spec interface
|
||||||
func (ds depspec) GetDevDependencies() []ProjectDep {
|
func (ds depspec) GetDevDependencies() []ProjectDep {
|
||||||
return nil
|
return ds.devdeps
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl Spec interface
|
// impl Spec interface
|
||||||
|
@ -508,48 +551,6 @@ func rootDependency() {
|
||||||
}, error: couldNotSolve);
|
}, error: couldNotSolve);
|
||||||
}
|
}
|
||||||
|
|
||||||
func devDependency() {
|
|
||||||
testResolve("includes root package's dev dependencies", {
|
|
||||||
"myapp 1.0.0": {
|
|
||||||
"(dev) foo": "1.0.0",
|
|
||||||
"(dev) bar": "1.0.0"
|
|
||||||
},
|
|
||||||
"foo 1.0.0": {},
|
|
||||||
"bar 1.0.0": {}
|
|
||||||
}, result: {
|
|
||||||
"myapp from root": "1.0.0",
|
|
||||||
"foo": "1.0.0",
|
|
||||||
"bar": "1.0.0"
|
|
||||||
});
|
|
||||||
|
|
||||||
testResolve("includes dev dependency's transitive dependencies", {
|
|
||||||
"myapp 1.0.0": {
|
|
||||||
"(dev) foo": "1.0.0"
|
|
||||||
},
|
|
||||||
"foo 1.0.0": {
|
|
||||||
"bar": "1.0.0"
|
|
||||||
},
|
|
||||||
"bar 1.0.0": {}
|
|
||||||
}, result: {
|
|
||||||
"myapp from root": "1.0.0",
|
|
||||||
"foo": "1.0.0",
|
|
||||||
"bar": "1.0.0"
|
|
||||||
});
|
|
||||||
|
|
||||||
testResolve("ignores transitive dependency's dev dependencies", {
|
|
||||||
"myapp 1.0.0": {
|
|
||||||
"foo": "1.0.0"
|
|
||||||
},
|
|
||||||
"foo 1.0.0": {
|
|
||||||
"(dev) bar": "1.0.0"
|
|
||||||
},
|
|
||||||
"bar 1.0.0": {}
|
|
||||||
}, result: {
|
|
||||||
"myapp from root": "1.0.0",
|
|
||||||
"foo": "1.0.0"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
func unsolvable() {
|
func unsolvable() {
|
||||||
testResolve("no version that matches requirement", {
|
testResolve("no version that matches requirement", {
|
||||||
"myapp 0.0.0": {
|
"myapp 0.0.0": {
|
||||||
|
|
|
@ -83,7 +83,7 @@ func (u *unselected) Pop() (v interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove takes a ProjectIdentifier out of the priority queue (if it was
|
// remove takes a ProjectIdentifier out of the priority queue (if it was
|
||||||
// present), then reapplies the heap invariants.
|
// present), then reasserts the heap invariants.
|
||||||
func (u *unselected) remove(id ProjectName) {
|
func (u *unselected) remove(id ProjectName) {
|
||||||
for k, pi := range u.sl {
|
for k, pi := range u.sl {
|
||||||
if pi == id {
|
if pi == id {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче