expect

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: MIT Imports: 1 Imported by: 0

README

expect

A utilities library for golang testing.

Documentation

Overview

This package provides a simpler way to write unit tests in golang. You can write a unit test in such coding style:

func TestExpect(t *testing.T) {
	expect.Bind(t).Expect("it" + " " + "works").ToBe("it works")

	var e = expect.Bind(t)
	e.Expect(1 + 1).ToBe(2)
	e.Expect(2 + 2).ToBe(4)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpectHandler

type ExpectHandler struct {
	TesterHandler
	// contains filtered or unexported fields
}

func (*ExpectHandler) ToBe

func (e *ExpectHandler) ToBe(expect any)

type TesterHandler

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

func Bind

func Bind(testing *testing.T) *TesterHandler

func (*TesterHandler) Expect

func (t *TesterHandler) Expect(actual any) *ExpectHandler

Jump to

Keyboard shortcuts

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