go-testing-interface: github.com/mitchellh/go-testing-interface Index | Files

package testing

import "github.com/mitchellh/go-testing-interface"

Index

Package Files

testing.go

type RuntimeT Uses

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

RuntimeT implements T and can be instantiated and run at runtime to mimic *testing.T behavior. Unlike *testing.T, this will simply panic for calls to Fatal. For calls to Error, you'll have to check the errors list to determine whether to exit yourself.

Cleanup does NOT work, so if you're using a helper that uses Cleanup, there may be dangling resources.

Parallel does not do anything.

func (*RuntimeT) Cleanup Uses

func (t *RuntimeT) Cleanup(func())

func (*RuntimeT) Error Uses

func (t *RuntimeT) Error(args ...interface{})

func (*RuntimeT) Errorf Uses

func (t *RuntimeT) Errorf(format string, args ...interface{})

func (*RuntimeT) Fail Uses

func (t *RuntimeT) Fail()

func (*RuntimeT) FailNow Uses

func (t *RuntimeT) FailNow()

func (*RuntimeT) Failed Uses

func (t *RuntimeT) Failed() bool

func (*RuntimeT) Fatal Uses

func (t *RuntimeT) Fatal(args ...interface{})

func (*RuntimeT) Fatalf Uses

func (t *RuntimeT) Fatalf(format string, args ...interface{})

func (*RuntimeT) Helper Uses

func (t *RuntimeT) Helper()

func (*RuntimeT) Log Uses

func (t *RuntimeT) Log(args ...interface{})

func (*RuntimeT) Logf Uses

func (t *RuntimeT) Logf(format string, args ...interface{})

func (*RuntimeT) Name Uses

func (t *RuntimeT) Name() string

func (*RuntimeT) Parallel Uses

func (t *RuntimeT) Parallel()

func (*RuntimeT) Skip Uses

func (t *RuntimeT) Skip(args ...interface{})

func (*RuntimeT) SkipNow Uses

func (t *RuntimeT) SkipNow()

func (*RuntimeT) Skipf Uses

func (t *RuntimeT) Skipf(format string, args ...interface{})

func (*RuntimeT) Skipped Uses

func (t *RuntimeT) Skipped() bool

type T Uses

type T interface {
    Cleanup(func())
    Error(args ...interface{})
    Errorf(format string, args ...interface{})
    Fail()
    FailNow()
    Failed() bool
    Fatal(args ...interface{})
    Fatalf(format string, args ...interface{})
    Helper()
    Log(args ...interface{})
    Logf(format string, args ...interface{})
    Name() string
    Parallel()
    Skip(args ...interface{})
    SkipNow()
    Skipf(format string, args ...interface{})
    Skipped() bool
}

T is the interface that mimics the standard library *testing.T.

In unit tests you can just pass a *testing.T struct. At runtime, outside of tests, you can pass in a RuntimeT struct from this package.

Package testing imports 2 packages (graph) and is imported by 336 packages. Updated 2020-05-01. Refresh now. Tools for package owners.