Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 8a46f4d

Browse files
committed
Fix gps solver tests
Stupid variable assignment in loop was broken. Also, add one more test case to check that a root require causes corresponding constraints to be activated.
1 parent b6765a5 commit 8a46f4d

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

internal/gps/solve_bimodal_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,23 @@ var bimodalFixtures = map[string]bimodalFixture{
887887
"baz 1.0.0",
888888
),
889889
},
890+
"require activates constraints": {
891+
ds: []depspec{
892+
dsp(mkDepspec("root 0.0.0", "foo 1.0.0", "bar 1.0.0"),
893+
pkg("root", "foo")),
894+
dsp(mkDepspec("foo 1.0.0"),
895+
pkg("foo", "bar")),
896+
dsp(mkDepspec("bar 1.0.0"),
897+
pkg("bar")),
898+
dsp(mkDepspec("bar 1.1.0"),
899+
pkg("bar")),
900+
},
901+
require: []string{"bar"},
902+
r: mksolution(
903+
"foo 1.0.0",
904+
"bar 1.0.0",
905+
),
906+
},
890907
"require subpackage": {
891908
ds: []depspec{
892909
dsp(mkDepspec("root 0.0.0", "bar 1.0.0"),

internal/gps/solve_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ func TestBasicSolves(t *testing.T) {
7474

7575
sort.Strings(names)
7676
for _, n := range names {
77+
n := n
7778
t.Run(n, func(t *testing.T) {
7879
t.Parallel()
7980
solveBasicsAndCheck(basicFixtures[n], t)
@@ -116,6 +117,7 @@ func TestBimodalSolves(t *testing.T) {
116117

117118
sort.Strings(names)
118119
for _, n := range names {
120+
n := n
119121
t.Run(n, func(t *testing.T) {
120122
t.Parallel()
121123
solveBimodalAndCheck(bimodalFixtures[n], t)

0 commit comments

Comments
 (0)