(t *testing.T)
| 71 | } |
| 72 | |
| 73 | func TestCacheInvalidation(t *testing.T) { |
| 74 | dir := t.TempDir() |
| 75 | path := filepath.Join(dir, "SOUL.md") |
| 76 | _ = os.WriteFile(path, []byte("v1"), 0o644) |
| 77 | |
| 78 | bl := NewBootstrapLoader(dir, "", testLogger()) |
| 79 | c1, _ := bl.LoadFile("SOUL.md") |
| 80 | if c1 != "v1" { |
| 81 | t.Fatalf("expected 'v1', got %q", c1) |
| 82 | } |
| 83 | |
| 84 | // Modify file (need to wait for mtime to change) |
| 85 | time.Sleep(10 * time.Millisecond) |
| 86 | _ = os.WriteFile(path, []byte("v2"), 0o644) |
| 87 | |
| 88 | c2, _ := bl.LoadFile("SOUL.md") |
| 89 | if c2 != "v2" { |
| 90 | t.Errorf("expected 'v2' after modification, got %q", c2) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | func TestIsStale(t *testing.T) { |
| 95 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected