Categorygithub.com/vcaesar/tt
modulepackage
0.20.1
Repository: https://github.com/vcaesar/tt.git
Documentation: pkg.go.dev

# README

tt

Simple and colorful test tools

CircleCI Status Appveyor codecov Build Status Go Report Card GoDoc Release Join the chat at https://gitter.im/go-ego/ego

Installation/Update

go get -u github.com/vcaesar/tt

Usage:

Look at an example

package tt

import (
	"fmt"
	"testing"

	"github.com/vcaesar/tt"
	"github.com/vcaesar/tt/example"
)

func TestAdd(t *testing.T) {
	fmt.Println(add.Add(1, 1))

	tt.Expect(t, "1", add.Add(1, 1))
	tt.Expect(t, "2", add.Add(1, 1))

	tt.Equal(t, 1, add.Add(1, 1))
	tt.Equal(t, 2, add.Add(1, 1))

	at := tt.New(t)
	at.Expect("2", add.Add(1, 1))
	at.Equal(2, add.Add(1, 1))
}

func Benchmark1(b *testing.B) {
	at := tt.New(b)
	fn := func() {
		at.Equal(2, add.Add(1, 1))
	}

	tt.BM(b, fn)
	// at.BM(b, fn)
}

func Benchmark2(b *testing.B) {
	at := tt.New(b)
	for i := 0; i < b.N; i++ {
		at.Equal(2, Add(1, 1))
	}
}

Thanks

Testify, the code has some inspiration.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

Blue returns a blue string.
BM func Benchmark1(b *testing.B, fn func()).
Bold returns a blod string.
Bool asserts that true and objects are equal.
CallerInfo returns an array of strings containing the file and line number, and each stack frame leading from the current test, when the assert call that failed.
DEqual asserts that two objects are deep equal.
Drop set drop tag and println log.
Empty asserts that empty and objects are equal.
Equal asserts that two objects are equal.
Err dbg fatal error log.
Error asserts that equal error.
Expect asserts that string and objects are equal.
False asserts that flase and objects are equal.
Fmt return error string.
FmtErr return error string.
IsType asserts that two objects type are equal.
IsTypes return bool when actual is expect type.
Log dbg println log.
New makes a new Assertions object for the specified TestingT.
Nil asserts that nil and objects are equal.
Not asserts that two objects are not equal.
NotEmpty asserts that empty and objects are not equal.
NotEqual asserts that two objects are not equal.
NotErr return not equal error string.
NotExpect asserts that string and objects are not equal.
NotNil asserts that not equal nil.
NotZero asserts that zero and objects are not equal.
Pprof use: Mem: pprof -http=:8090 http://127.0.0.1:6060/debug/pprof/heap go tool pprof http://localhost:6060/debug/pprof/heap CPU: debug/pprof/profile set time: debug/pprof/profile\?seconds\=10 pprof -http=:8090 http://127.0.0.1:6060/debug/pprof/profile\?seconds\=10 debug/pprof/block debug/pprof/mutex.
Red returns a red string.
RedBold returns a red bold string.
True asserts that true and objects are equal.
TypeF make Type false.
TypeOf equal two interface{} type.
UnUsed not used tag and println log.
Yellow returns a yellow string.
Zero asserts that zero and objects are equal.

# Constants

Version get the tt version.

# Variables

Type type must.

# Structs

Assertions provides assertion methods around the TestingT interface.

# Interfaces

TestingT is an interface wrapper around *testing.T.