1 Star 1 Fork 0

benjamin.zhang/miniredis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test_test.go 883 Bytes
一键复制 编辑 原始数据 按行查看 历史
Harmen 提交于 2018-06-07 14:06 . stop test on failure
package miniredis
import (
"reflect"
"testing"
)
// assert fails the test if the condition is false.
func assert(tb testing.TB, condition bool, msg string, v ...interface{}) {
tb.Helper()
if !condition {
tb.Errorf(msg, v...)
}
}
// ok fails the test if an err is not nil.
func ok(tb testing.TB, err error) {
tb.Helper()
if err != nil {
tb.Errorf("unexpected error: %s", err.Error())
}
}
// equals fails the test if exp is not equal to act.
func equals(tb testing.TB, exp, act interface{}) {
tb.Helper()
if !reflect.DeepEqual(exp, act) {
tb.Errorf("expected: %#v got: %#v", exp, act)
}
}
// mustFail compares the error strings
func mustFail(tb testing.TB, err error, want string) {
tb.Helper()
if err == nil {
tb.Errorf("expected an error, but got a nil")
return
}
if have := err.Error(); have != want {
tb.Errorf("have %q, want %q", have, want)
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/threeDaoLiu/miniredis.git
git@gitee.com:threeDaoLiu/miniredis.git
threeDaoLiu
miniredis
miniredis
master

搜索帮助