forked from p93542168/wheat-cache
test(test-test): add test
This commit is contained in:
parent
3709b6f8e5
commit
77cde0b2ef
|
@ -8,10 +8,10 @@ import (
|
||||||
// 保证所有函数和变量最小作用域
|
// 保证所有函数和变量最小作用域
|
||||||
|
|
||||||
func Test(a int) (string, error) {
|
func Test(a int) (string, error) {
|
||||||
|
// awd
|
||||||
return strconv.Itoa(a), nil
|
return strconv.Itoa(a), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Nows() string {
|
func Nows() string {
|
||||||
return time.Now().Format("2006-01-02")
|
return time.Now().Format("2006-01-02")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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())
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue