File: imports_test.go

package info (click to toggle)
golang-github-juju-testing 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 512 kB
  • sloc: makefile: 6
file content (45 lines) | stat: -rw-r--r-- 1,039 bytes parent folder | download
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
45
// 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) {
	c.Skip("Skipping test that doesn't work with Debian's import paths")
	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)
	}
}