tester

package
v0.0.0-...-b52e947 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2016 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package tester provides the functionality needed to test a package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RunResult

type RunResult struct {
	OK          []string
	FailedGet   []string
	FailedBuild []string
	FailedTests []string
}

RunResult contains the results from using Run

func Run

func Run(t *Test, pkgs []string, w io.Writer) *RunResult

Run takes a list of packages and uses the given Test to fetch and run all the packages tests. It prints progress to the given io.Writer.

func (RunResult) Err

func (r RunResult) Err() error

Err returns and error if any package failed testing. Nil otherwise.

func (RunResult) String

func (r RunResult) String() string

String prints a one liner summary of the run

func (RunResult) Total

func (r RunResult) Total() int

Total returns the amount of packages that were tested

func (RunResult) TotalFailed

func (r RunResult) TotalFailed() int

TotalFailed returns the amount of packages that failed testing

type Test

type Test struct {
	// Gopath used to fetch the package and run the tests
	Gopath string

	// Stdout writer to get the command's output
	Stdout io.Writer
	// Stderr writer to get the command's output
	Stderr io.Writer
}

Test contains the details to fetch packages and run tests

func NewTempTest

func NewTempTest() (*Test, error)

NewTempTest returns a Test with Gopath set to a clean temporary folder. It returns an error when the temporary folder cannot be created.

func (*Test) Build

func (t *Test) Build(pkg string) error

Build builds the package

func (*Test) Checkout

func (t *Test) Checkout(pkg, rev string) error

Checkout allows you to checkout a specific revision of the given package into the Test's gopath

func (*Test) FetchRemote

func (t *Test) FetchRemote(pkg, name, url string) error

FetchRemote allows you to fetch commits from another remote source

func (*Test) Get

func (t *Test) Get(pkg string) error

Get fetches the package and its dependencies

func (*Test) Test

func (t *Test) Test(pkg string) error

Test runs the tests form the package

Jump to

Keyboard shortcuts

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