使用相对于项目地址的配置文件路径以便于单元测试
This commit is contained in:
16
models/elasticsearch_test.go
Normal file
16
models/elasticsearch_test.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMyFunction(t *testing.T) {
|
||||
// 创建一个测试用例
|
||||
expected := 10
|
||||
actual := ElasticsearchSearch("豌豆")
|
||||
|
||||
// 使用 assert 包中的函数来验证函数的输出
|
||||
assert.Equal(t, expected, actual)
|
||||
}
|
Reference in New Issue
Block a user