MCPcopy Create free account
hub / github.com/diillson/chatcli / TestRulesLoader_GlobalRules

Function TestRulesLoader_GlobalRules

cli/workspace/rules_test.go:10–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestRulesLoader_GlobalRules(t *testing.T) {
11 globalDir := t.TempDir()
12 rulesDir := filepath.Join(globalDir, "rules")
13 _ = os.MkdirAll(rulesDir, 0o755)
14
15 // Create a global rule (no paths = applies everywhere)
16 _ = os.WriteFile(filepath.Join(rulesDir, "style.md"), []byte("Always use snake_case for Go variables."), 0o644)
17
18 rl := NewRulesLoader(t.TempDir(), globalDir, testLogger())
19 result := rl.LoadMatchingRules(nil)
20
21 if !strings.Contains(result, "snake_case") {
22 t.Errorf("expected global rule content, got %q", result)
23 }
24 if !strings.Contains(result, "style") {
25 t.Errorf("expected rule name 'style' in output, got %q", result)
26 }
27}
28
29func TestRulesLoader_PathSpecificRule(t *testing.T) {
30 wsDir := t.TempDir()

Callers

nothing calls this directly

Calls 4

LoadMatchingRulesMethod · 0.95
NewRulesLoaderFunction · 0.85
ErrorfMethod · 0.80
testLoggerFunction · 0.70

Tested by

no test coverage detected