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

Function AssertFileContent

pkg/tools/builtin/testutils.go:355–366  ·  view source on GitHub ↗

AssertFileContent 断言文件内容

(t *testing.T, path, expectedContent string)

Source from the content-addressed store, hash-verified

353
354// AssertFileContent 断言文件内容
355func AssertFileContent(t *testing.T, path, expectedContent string) {
356 content, err := os.ReadFile(path)
357 if err != nil {
358 t.Errorf("Failed to read file %q: %v", path, err)
359 return
360 }
361
362 if string(content) != expectedContent {
363 t.Errorf("File content mismatch for %q.\nExpected: %q\nActual: %q",
364 path, expectedContent, string(content))
365 }
366}
367
368// CreateTestFiles 创建标准测试文件
369func CreateTestFiles(th *TestHelper) map[string]string {

Calls 1

ReadFileMethod · 0.45