lib

package
v0.0.0-...-54f39e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2014 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenPkg

func GenPkg(srcPath, dstRoot, name string, mock bool, cfg *MockConfig) (importSet, error)

func GetCmdOutput

func GetCmdOutput(cmd *exec.Cmd) (string, error)

func GetImports

func GetImports(path string, tests bool) (importSet, error)

func GetMockedPackages

func GetMockedPackages(path string) (map[string]string, error)

func GetOutput

func GetOutput(name string, args ...string) (string, error)

func LinkPkg

func LinkPkg(srcPath, dstRoot, name string) (importSet, error)

func LookupImportPath

func LookupImportPath(impPath string) (string, error)

func MakePkg

func MakePkg(srcPath, dstPath, pkgName string, mock bool, cfg *MockConfig) (importSet, error)

MakePkg writes a mock version of the package found at srcPath into dstPath. If dstPath already exists, bad things will probably happen.

func MockImports

func MockImports(src, dst string, names map[string]string, cfg *Config) error

func MockInterfaces

func MockInterfaces(tmpPath, pkgName string, cfg *MockConfig) error

func MockStandard

func MockStandard(srcRoot, dstRoot, name string, cfg *MockConfig) error

func NewRewriter

func NewRewriter(w io.Writer) *rewriter

func ReplacePkg

func ReplacePkg(srcPath, dstRoot, from, as string) (importSet, error)

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(tmpDir string) *Cache

func (*Cache) Fetch

func (c *Cache) Fetch(path string) (Package, error)

func (*Cache) Store

func (c *Cache) Store(path string) error

type Cerr

type Cerr struct {
	Ctxt string
	Err  error
}

func (Cerr) Context

func (c Cerr) Context() string

func (Cerr) Error

func (c Cerr) Error() string

type Config

type Config struct {
	Mocks map[string]*MockConfig
}

func ReadConfig

func ReadConfig(path string) (*Config, error)

func (*Config) Mock

func (c *Config) Mock(path string) *MockConfig

type Context

type Context struct {
	// contains filtered or unexported fields
}

func NewContext

func NewContext() (*Context, error)

func (*Context) AddPackage

func (c *Context) AddPackage(pkgName string) (string, error)

func (*Context) Chdir

func (c *Context) Chdir(pkg string) error

func (*Context) Close

func (c *Context) Close() error

func (*Context) DisableRewrite

func (c *Context) DisableRewrite()

func (*Context) ExcludePackagesFromFile

func (c *Context) ExcludePackagesFromFile(path string) error

func (*Context) KeepWork

func (c *Context) KeepWork()

func (*Context) LinkPackage

func (c *Context) LinkPackage(pkg string) error

func (*Context) LinkPackagesFromFile

func (c *Context) LinkPackagesFromFile(path string) error

func (*Context) LoadConfig

func (c *Context) LoadConfig(path string) (err error)

func (*Context) Run

func (c *Context) Run(command string, args ...string) error

type Interfaces

type Interfaces map[string]*ifInfo

type MockConfig

type MockConfig struct {
	// Local configuration
	MockPrototypes   bool // Mock prototypes (i.e. functions without bodies)
	IgnoreInits      bool // Don't call the original init functions
	MatchOSArch      bool // only use files for GOOS & GOARCH
	IgnoreNonGoFiles bool // Don't copy non-go files into the mocked package

	// File based configuration
	MOCK      string `yaml:"MOCK"`
	EXPECT    string `yaml:"EXPECT"`
	ObjEXPECT string `yaml:"obj.EXPECT"`
}

type Package

type Package interface {
	Name() string
	Label() string
	Path() string
	Loc() codeLoc
	HasNonGoCode() (bool, error)

	DisableInstall()

	GetImports() (importSet, error)
	MockImports(map[string]string, *Config) error

	Link() (importSet, error)
	Gen(mock bool, cfg *MockConfig) (importSet, error)
	Install() error
}

func NewPackage

func NewPackage(pkgName, label, tmpDir, goPath string) (Package, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL