MCPcopy Create free account
hub / github.com/JordanCoin/codemap / writeMainWatchState

Function writeMainWatchState

main_more_test.go:164–183  ·  view source on GitHub ↗
(t *testing.T, root string, state watch.State, running bool)

Source from the content-addressed store, hash-verified

162}
163
164func 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
185func writeImportersFixture(t *testing.T, root string) {
186 t.Helper()

Calls 2

WritePIDFunction · 0.92
RemovePIDFunction · 0.92

Tested by

no test coverage detected