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

Function TestLoad_MalformedJSON

config/config_test.go:123–139  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

121}
122
123func TestLoad_MalformedJSON(t *testing.T) {
124 dir := t.TempDir()
125 codemapDir := filepath.Join(dir, ".codemap")
126 if err := os.MkdirAll(codemapDir, 0755); err != nil {
127 t.Fatal(err)
128 }
129
130 data := `{not valid json`
131 if err := os.WriteFile(filepath.Join(codemapDir, "config.json"), []byte(data), 0644); err != nil {
132 t.Fatal(err)
133 }
134
135 cfg := Load(dir)
136 if len(cfg.Only) != 0 || len(cfg.Exclude) != 0 || cfg.Depth != 0 {
137 t.Errorf("expected zero-value config for malformed JSON, got %+v", cfg)
138 }
139}
140
141func TestLoad_EmptyObject(t *testing.T) {
142 dir := t.TempDir()

Callers

nothing calls this directly

Calls 1

LoadFunction · 0.85

Tested by

no test coverage detected