preflight

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 5 Imported by: 0

README

preflight

Go Reference Conventional Commits

Readable assertions for tests in Go

Installation

go get vincent.click/pkg/preflight

Getting Started

To write unit tests, use the preflight package to extend the standard testing package.

An Expectation provides a common interface for making assertions about values and behaviors.

Learn more in the docs.

func TestMethod(test *testing.T) {
    t := preflight.Unit(test)

    t.Expect(2 + 5).Equals(7)
}

Development

Please read the Contribution Guide before you proceed.

Copyright 2021 Vincent Fiestada. This project is released under an MIT License.

Icon made by Freepik.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Captor = captor.New()

Functions

This section is empty.

Types

type Test

type Test struct {
	*testing.T
}

Test provides utilities for testing

func Unit

func Unit(t *testing.T) *Test

Unit returns a new unit test

func (*Test) Expect

func (t *Test) Expect(actual interface{}) expect.Expectation

Expect returns a new value-based expectation

func (*Test) ExpectExitCode

func (t *Test) ExpectExitCode(act captor.Action) expect.Expectation

ExpectExitCode returns an expectation about a captured exit code

func (*Test) ExpectFile

func (t *Test) ExpectFile(f *os.File) stream.Expectations

ExpectFile returns a set of expectations about a file

func (*Test) ExpectPanic

func (t *Test) ExpectPanic(act captor.Action) expect.Expectation

ExpectPanic returns an expectation about the cause of a panicking goroutine

func (*Test) ExpectWritten

func (t *Test) ExpectWritten(consumer stream.Consumer) stream.Expectations

ExpectWritten returns a set of expectations about data written to a stream

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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