File: path_test.go

package info (click to toggle)
golang-github-juju-errors 0.0~git20170703.0.c7d06af-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 176 kB
  • sloc: makefile: 10
file content (29 lines) | stat: -rw-r--r-- 681 bytes parent folder | download | duplicates (2)
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
// Copyright 2013, 2014 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.

package errors_test

import (
	"path"

	gc "gopkg.in/check.v1"

	"github.com/juju/errors"
)

type pathSuite struct{}

var _ = gc.Suite(&pathSuite{})

func (*pathSuite) TestGoPathSet(c *gc.C) {
	c.Assert(errors.GoPath(), gc.Not(gc.Equals), "")
}

func (*pathSuite) TestTrimGoPath(c *gc.C) {
	relativeImport := "github.com/foo/bar/baz.go"
	filename := path.Join(errors.GoPath(), relativeImport)
	c.Assert(errors.TrimGoPath(filename), gc.Equals, relativeImport)

	absoluteImport := "/usr/share/foo/bar/baz.go"
	c.Assert(errors.TrimGoPath(absoluteImport), gc.Equals, absoluteImport)
}