(t *testing.T)
| 515 | } |
| 516 | |
| 517 | func TestHashLocalFile(t *testing.T) { |
| 518 | dir := t.TempDir() |
| 519 | path := filepath.Join(dir, "test.md") |
| 520 | writeFile(t, path, "hello world") |
| 521 | |
| 522 | h1, err := HashLocalFile(path) |
| 523 | if err != nil { |
| 524 | t.Fatalf("unexpected error: %v", err) |
| 525 | } |
| 526 | |
| 527 | h2, err := HashLocalFile(path) |
| 528 | if err != nil { |
| 529 | t.Fatalf("unexpected error: %v", err) |
| 530 | } |
| 531 | |
| 532 | if h1 != h2 { |
| 533 | t.Error("hash not deterministic") |
| 534 | } |
| 535 | |
| 536 | // Different content → different hash |
| 537 | writeFile(t, path, "different content") |
| 538 | h3, err := HashLocalFile(path) |
| 539 | if err != nil { |
| 540 | t.Fatalf("unexpected error: %v", err) |
| 541 | } |
| 542 | if h1 == h3 { |
| 543 | t.Error("expected different hash for different content") |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | func TestHashLocalFile_NonexistentFile(t *testing.T) { |
| 548 | _, err := HashLocalFile("/nonexistent/path.md") |
nothing calls this directly
no test coverage detected