AssertFileContent 断言文件内容
(t *testing.T, path, expectedContent string)
| 353 | |
| 354 | // AssertFileContent 断言文件内容 |
| 355 | func 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 创建标准测试文件 |
| 369 | func CreateTestFiles(th *TestHelper) map[string]string { |