(t *testing.T, root string, state watch.State, running bool)
| 162 | } |
| 163 | |
| 164 | func writeMainWatchState(t *testing.T, root string, state watch.State, running bool) { |
| 165 | t.Helper() |
| 166 | |
| 167 | if err := os.MkdirAll(filepath.Join(root, ".codemap"), 0o755); err != nil { |
| 168 | t.Fatal(err) |
| 169 | } |
| 170 | data, err := json.Marshal(state) |
| 171 | if err != nil { |
| 172 | t.Fatal(err) |
| 173 | } |
| 174 | if err := os.WriteFile(filepath.Join(root, ".codemap", "state.json"), data, 0o644); err != nil { |
| 175 | t.Fatal(err) |
| 176 | } |
| 177 | if running { |
| 178 | if err := watch.WritePID(root); err != nil { |
| 179 | t.Fatal(err) |
| 180 | } |
| 181 | t.Cleanup(func() { watch.RemovePID(root) }) |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | func writeImportersFixture(t *testing.T, root string) { |
| 186 | t.Helper() |
no test coverage detected