From 8a46f4d97894a71fa116126b5bc79d6b3293a0cc Mon Sep 17 00:00:00 2001 From: sam boyer Date: Tue, 1 Aug 2017 00:21:31 -0400 Subject: [PATCH] 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. --- internal/gps/solve_bimodal_test.go | 17 +++++++++++++++++ internal/gps/solve_test.go | 2 ++ 2 files changed, 19 insertions(+) diff --git a/internal/gps/solve_bimodal_test.go b/internal/gps/solve_bimodal_test.go index a348ecfbf8..60d0202834 100644 --- a/internal/gps/solve_bimodal_test.go +++ b/internal/gps/solve_bimodal_test.go @@ -887,6 +887,23 @@ var bimodalFixtures = map[string]bimodalFixture{ "baz 1.0.0", ), }, + "require activates constraints": { + ds: []depspec{ + dsp(mkDepspec("root 0.0.0", "foo 1.0.0", "bar 1.0.0"), + pkg("root", "foo")), + dsp(mkDepspec("foo 1.0.0"), + pkg("foo", "bar")), + dsp(mkDepspec("bar 1.0.0"), + pkg("bar")), + dsp(mkDepspec("bar 1.1.0"), + pkg("bar")), + }, + require: []string{"bar"}, + r: mksolution( + "foo 1.0.0", + "bar 1.0.0", + ), + }, "require subpackage": { ds: []depspec{ dsp(mkDepspec("root 0.0.0", "bar 1.0.0"), diff --git a/internal/gps/solve_test.go b/internal/gps/solve_test.go index cf2363d80d..daca928db2 100644 --- a/internal/gps/solve_test.go +++ b/internal/gps/solve_test.go @@ -74,6 +74,7 @@ func TestBasicSolves(t *testing.T) { sort.Strings(names) for _, n := range names { + n := n t.Run(n, func(t *testing.T) { t.Parallel() solveBasicsAndCheck(basicFixtures[n], t) @@ -116,6 +117,7 @@ func TestBimodalSolves(t *testing.T) { sort.Strings(names) for _, n := range names { + n := n t.Run(n, func(t *testing.T) { t.Parallel() solveBimodalAndCheck(bimodalFixtures[n], t)