Пример #1
0
func (s *importsSuite) TestImports(c *gc.C) {
	goPath := writePkgs(c)
	s.PatchValue(&build.Default.GOPATH, goPath)

	c.Logf("gopath %q", build.Default.GOPATH)
	for i, test := range importsTests {
		c.Logf("test %d: %s %s", i, test.pkgName, test.prefix)
		imports, err := testing.FindImports(test.pkgName, test.prefix)
		c.Assert(err, gc.IsNil)
		c.Assert(imports, jc.DeepEquals, test.expect)
	}
}
Пример #2
0
// FindJujuCoreImports returns a sorted list of juju-core packages that are
// imported by the packageName parameter.  The resulting list removes the
// common prefix "github.com/juju/core/" leaving just the short names.
func FindJujuCoreImports(c *gc.C, packageName string) []string {
	imps, err := testing.FindImports(packageName, jujuPkgPrefix)
	c.Assert(err, gc.IsNil)
	return imps
}