dep: Fix erroneous test use of non-project root

This commit is contained in:
sam boyer 2018-01-24 08:51:16 -05:00
Родитель e96a004730
Коммит 69763c4289
2 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -32,7 +32,7 @@ func TestReadManifest(t *testing.T) {
c, _ := gps.NewSemverConstraint("^0.12.0") c, _ := gps.NewSemverConstraint("^0.12.0")
want := Manifest{ want := Manifest{
Constraints: map[gps.ProjectRoot]gps.ProjectProperties{ Constraints: map[gps.ProjectRoot]gps.ProjectProperties{
gps.ProjectRoot("github.com/golang/dep/gps"): { gps.ProjectRoot("github.com/golang/dep"): {
Constraint: c, Constraint: c,
}, },
gps.ProjectRoot("github.com/babble/brook"): { gps.ProjectRoot("github.com/babble/brook"): {
@ -40,8 +40,8 @@ func TestReadManifest(t *testing.T) {
}, },
}, },
Ovr: map[gps.ProjectRoot]gps.ProjectProperties{ Ovr: map[gps.ProjectRoot]gps.ProjectProperties{
gps.ProjectRoot("github.com/golang/dep/gps"): { gps.ProjectRoot("github.com/golang/dep"): {
Source: "https://github.com/golang/dep/gps", Source: "https://github.com/golang/dep",
Constraint: gps.NewBranch("master"), Constraint: gps.NewBranch("master"),
}, },
}, },
@ -74,14 +74,14 @@ func TestWriteManifest(t *testing.T) {
want := h.GetTestFileString(golden) want := h.GetTestFileString(golden)
c, _ := gps.NewSemverConstraint("^0.12.0") c, _ := gps.NewSemverConstraint("^0.12.0")
m := NewManifest() m := NewManifest()
m.Constraints[gps.ProjectRoot("github.com/golang/dep/gps")] = gps.ProjectProperties{ m.Constraints[gps.ProjectRoot("github.com/golang/dep")] = gps.ProjectProperties{
Constraint: c, Constraint: c,
} }
m.Constraints[gps.ProjectRoot("github.com/babble/brook")] = gps.ProjectProperties{ m.Constraints[gps.ProjectRoot("github.com/babble/brook")] = gps.ProjectProperties{
Constraint: gps.Revision("d05d5aca9f895d19e9265839bffeadd74a2d2ecb"), Constraint: gps.Revision("d05d5aca9f895d19e9265839bffeadd74a2d2ecb"),
} }
m.Ovr[gps.ProjectRoot("github.com/golang/dep/gps")] = gps.ProjectProperties{ m.Ovr[gps.ProjectRoot("github.com/golang/dep")] = gps.ProjectProperties{
Source: "https://github.com/golang/dep/gps", Source: "https://github.com/golang/dep",
Constraint: gps.NewBranch("master"), Constraint: gps.NewBranch("master"),
} }
m.Ignored = []string{"github.com/foo/bar"} m.Ignored = []string{"github.com/foo/bar"}
@ -622,7 +622,7 @@ func TestFromRawPruneOptions(t *testing.T) {
GoTests: true, GoTests: true,
Projects: []rawPruneProjectOptions{ Projects: []rawPruneProjectOptions{
{ {
Name: "github.com/golang/dep/gps", Name: "github.com/golang/dep",
UnusedPackages: false, UnusedPackages: false,
NonGoFiles: false, NonGoFiles: false,
GoTests: false, GoTests: false,
@ -632,7 +632,7 @@ func TestFromRawPruneOptions(t *testing.T) {
wantOptions: gps.RootPruneOptions{ wantOptions: gps.RootPruneOptions{
PruneOptions: 15, PruneOptions: 15,
ProjectOptions: gps.PruneProjectOptions{ ProjectOptions: gps.PruneProjectOptions{
"github.com/golang/dep/gps": 1, "github.com/golang/dep": 1,
}, },
}, },
}, },
@ -644,7 +644,7 @@ func TestFromRawPruneOptions(t *testing.T) {
GoTests: false, GoTests: false,
Projects: []rawPruneProjectOptions{ Projects: []rawPruneProjectOptions{
{ {
Name: "github.com/golang/dep/gps", Name: "github.com/golang/dep",
UnusedPackages: true, UnusedPackages: true,
NonGoFiles: true, NonGoFiles: true,
GoTests: true, GoTests: true,
@ -654,7 +654,7 @@ func TestFromRawPruneOptions(t *testing.T) {
wantOptions: gps.RootPruneOptions{ wantOptions: gps.RootPruneOptions{
PruneOptions: 1, PruneOptions: 1,
ProjectOptions: gps.PruneProjectOptions{ ProjectOptions: gps.PruneProjectOptions{
"github.com/golang/dep/gps": 15, "github.com/golang/dep": 15,
}, },
}, },
}, },

6
testdata/manifest/golden.toml поставляемый
Просмотреть файл

@ -5,10 +5,10 @@ ignored = ["github.com/foo/bar"]
revision = "d05d5aca9f895d19e9265839bffeadd74a2d2ecb" revision = "d05d5aca9f895d19e9265839bffeadd74a2d2ecb"
[[constraint]] [[constraint]]
name = "github.com/golang/dep/gps" name = "github.com/golang/dep"
version = "0.12.0" version = "0.12.0"
[[override]] [[override]]
branch = "master" branch = "master"
name = "github.com/golang/dep/gps" name = "github.com/golang/dep"
source = "https://github.com/golang/dep/gps" source = "https://github.com/golang/dep"