10 - 单元测试
官网
用户
internal\biz\user_test.go
package biz
import (
"testing"
"github.com/davecgh/go-spew/spew"
"github.com/stretchr/testify/assert"
)
func TestHashPassword(t *testing.T) {
s := hashPassword("333")
spew.Dump(s)
}
func TestVerifyPassword(t *testing.T) {
a := assert.New(t)
s1 := "$2a$10$IcnVlwc/DhVPCTFgkayCZ.un98RLPsdpOmNjaB4/0roouM/5HqIr."
input := "333"
s := verifyPassword(s1, input)
a.True(s)
// spew.Dump(s)
}