MCPcopy Create free account
hub / github.com/astercloud/aster / NewTestHelper

Function NewTestHelper

pkg/tools/builtin/testutils.go:26–38  ·  view source on GitHub ↗

NewTestHelper 创建测试辅助工具

(t *testing.T)

Source from the content-addressed store, hash-verified

24
25// NewTestHelper 创建测试辅助工具
26func NewTestHelper(t *testing.T) *TestHelper {
27 tmpDir, err := os.MkdirTemp("", "agentsdk_test_*")
28 if err != nil {
29 t.Fatalf("Failed to create temp dir: %v", err)
30 }
31
32 return &TestHelper{
33 T: t,
34 TmpDir: tmpDir,
35 Context: context.Background(),
36 Cleanup: []func(){func() { _ = os.RemoveAll(tmpDir) }},
37 }
38}
39
40// AddCleanup 添加清理函数
41func (th *TestHelper) AddCleanup(cleanup func()) {

Callers 15

TestReadTool_SuccessFunction · 0.85
TestReadTool_EmptyFileFunction · 0.85
TestReadTool_LargeFileFunction · 0.85
TestReadTool_BinaryFileFunction · 0.85
TestEditTool_SimpleEditFunction · 0.85
TestEditTool_SameStringFunction · 0.85

Calls

no outgoing calls

Tested by 15

TestReadTool_SuccessFunction · 0.68
TestReadTool_EmptyFileFunction · 0.68
TestReadTool_LargeFileFunction · 0.68
TestReadTool_BinaryFileFunction · 0.68
TestEditTool_SimpleEditFunction · 0.68
TestEditTool_SameStringFunction · 0.68