test(test-test): add test

This commit is contained in:
bandl 2021-08-21 21:20:57 +08:00
parent 3709b6f8e5
commit 77cde0b2ef
2 changed files with 19 additions and 1 deletions

View File

@ -8,10 +8,10 @@ import (
// 保证所有函数和变量最小作用域
func Test(a int) (string, error) {
// awd
return strconv.Itoa(a), nil
}
func Nows() string {
return time.Now().Format("2006-01-02")
}

18
pkg/lru/lru/lru_test.go Normal file
View File

@ -0,0 +1,18 @@
package lru
import (
"github.com/stretchr/testify/require"
"testing"
)
func TestTest(t *testing.T) {
ts , err := Test(2)
require.NoError(t, err)
require.Regexp(t, `\d`, ts)
ts, err = Test(3)
require.NoError(t, err)
require.Equal(t, "3", ts)
require.Regexp(t, `\d{4}-\d{2}-\d{2}`, Nows())
}