(t *testing.T)
| 123 | } |
| 124 | |
| 125 | func TestResolveConfigFile(t *testing.T) { |
| 126 | pathsOnce = sync.Once{} |
| 127 | tempDir := t.TempDir() |
| 128 | |
| 129 | // Without project config, should return global |
| 130 | resolved := ResolveConfigFile(tempDir) |
| 131 | if resolved != ConfigFile() { |
| 132 | t.Errorf("Expected global config, got %s", resolved) |
| 133 | } |
| 134 | |
| 135 | // With project config |
| 136 | projectDir := filepath.Join(tempDir, "myproject") |
| 137 | asterDir := filepath.Join(projectDir, ".aster") |
| 138 | if err := os.MkdirAll(asterDir, 0755); err != nil { |
| 139 | t.Fatal(err) |
| 140 | } |
| 141 | |
| 142 | configFile := filepath.Join(asterDir, "config.yaml") |
| 143 | if err := os.WriteFile(configFile, []byte("test: true"), 0644); err != nil { |
| 144 | t.Fatal(err) |
| 145 | } |
| 146 | |
| 147 | resolved = ResolveConfigFile(projectDir) |
| 148 | if resolved != configFile { |
| 149 | t.Errorf("Expected project config %s, got %s", configFile, resolved) |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | func contains(s, substr string) bool { |
| 154 | return len(s) >= len(substr) && (s == substr || len(s) > 0 && containsImpl(s, substr)) |
nothing calls this directly
no test coverage detected