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

Commit

Permalink
Add godep importer integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
darkowlzz committed May 16, 2017
1 parent e6726da commit 377095e
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/dep/godep_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ func (g *godepFile) convert(projectName string, sm gps.SourceManager) (*dep.Mani
}

func (g *godepFile) buildProjectConstraint(pkg godepPackage, sm gps.SourceManager) (pc gps.ProjectConstraint, err error) {
pc.Ident = gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot(pkg.ImportPath), Source: pkg.ImportPath}
pc.Ident = gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot(pkg.ImportPath)}
pc.Constraint, err = deduceConstraint(pkg.Comment, pc.Ident, sm)
return
}

func (g *godepFile) buildLockedProject(pkg godepPackage, manifest *dep.Manifest) gps.LockedProject {
var ver gps.Version
id := gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot(pkg.ImportPath), Source: pkg.ImportPath}
id := gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot(pkg.ImportPath)}
c, has := manifest.Dependencies[id.ProjectRoot]
if has {
// Create PairedVersion if constraint details are available
Expand Down
1 change: 1 addition & 0 deletions cmd/dep/import_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func newImportAnalyzer(loggers *dep.Loggers, sm gps.SourceManager) importAnalyze
func (a importAnalyzer) importManifestAndLock(dir string, pr gps.ProjectRoot) (*dep.Manifest, *dep.Lock, error) {
importers := []importer{
newGlideImporter(a.loggers, a.sm),
newGodepImporter(a.loggers, a.sm),
}

for _, i := range importers {
Expand Down
13 changes: 13 additions & 0 deletions cmd/dep/testdata/harness_tests/init/godep/case1/final/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

[[dependencies]]
branch = "master"
name = "github.com/sdboyer/deptest"

[[dependencies]]
name = "github.com/sdboyer/deptestdos"
version = "^2.0.0"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions cmd/dep/testdata/harness_tests/init/godep/case1/initial/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"fmt"

"github.com/sdboyer/deptestdos"
)

func main() {
var x deptestdos.Bar
fmt.Println(x)
}
13 changes: 13 additions & 0 deletions cmd/dep/testdata/harness_tests/init/godep/case1/testcase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"commands": [
["init", "-no-examples"]
],
"error-expected": "",
"gopath-initial": {
"github.com/sdboyer/deptest": "3f4c3bea144e112a69bbe5d8d01c1b09a544253f"
},
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
}
13 changes: 13 additions & 0 deletions cmd/dep/testdata/harness_tests/init/godep/case2/final/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

[[dependencies]]
name = "github.com/sdboyer/deptestdos"
version = "^2.0.0"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions cmd/dep/testdata/harness_tests/init/godep/case2/initial/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"fmt"

"github.com/sdboyer/deptestdos"
)

func main() {
var x deptestdos.Bar
fmt.Println(x)
}
11 changes: 11 additions & 0 deletions cmd/dep/testdata/harness_tests/init/godep/case2/testcase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commands": [
["init", "-no-examples", "-skip-tools"]
],
"error-expected": "",
"gopath-initial": {},
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
}

0 comments on commit 377095e

Please sign in to comment.