1 Star 0 Fork 0

vz / tt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
vz 提交于 2018-07-27 20:16 . Update README.md

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)
	for i := 0; i < b.N; i++ {
		at.Equal(2, Add(1, 1))
	}
}

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

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

Thanks

Testify, the code has some inspiration.

Go
1
https://gitee.com/veni0/tt.git
git@gitee.com:veni0/tt.git
veni0
tt
tt
master

搜索帮助