-
Notifications
You must be signed in to change notification settings - Fork 42
/
imports_test.go
44 lines (37 loc) · 969 Bytes
/
imports_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2014 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
package testing_test
import (
gc "gopkg.in/check.v1"
"github.com/juju/testing"
jc "github.com/juju/testing/checkers"
)
type importsSuite struct {
testing.CleanupSuite
}
var _ = gc.Suite(&importsSuite{})
var importsTests = []struct {
pkgName string
prefix string
expect []string
}{{
pkgName: "github.com/juju/testing",
prefix: "github.com/juju/testing/",
expect: []string{"checkers"},
}, {
pkgName: "github.com/juju/testing",
prefix: "github.com/juju/utils/v4/",
expect: []string{},
}, {
pkgName: "github.com/juju/testing",
prefix: "arble.com/",
expect: nil,
}}
func (s *importsSuite) TestImports(c *gc.C) {
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)
}
}