MCPcopy Create free account
hub / github.com/archlinux-de/pkgstats-cli / TestPacmanConfWithRelativePath

Function TestPacmanConfWithRelativePath

internal/pacman/pacman_test.go:188–219  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

186}
187
188func TestPacmanConfWithRelativePath(t *testing.T) {
189 tempDir := t.TempDir()
190 currentDir, err := os.Getwd()
191 if err != nil {
192 t.Fatal(err)
193 }
194 defer func() {
195 if err := os.Chdir(currentDir); err != nil {
196 t.Fatal(err)
197 }
198 }()
199
200 if err := os.Chdir(tempDir); err != nil {
201 t.Fatal(err)
202 }
203
204 if err := os.WriteFile("pacman.conf", fmt.Appendf(nil, "[core]\nServer=%s\n", MIRROR), 0o600); err != nil {
205 t.Fatalf("Failed to create pacman.conf: %v", err)
206 }
207
208 p, err := pacman.Parse("pacman.conf")
209 if err != nil {
210 t.Fatal(err)
211 }
212 out, err := p.GetServer()
213 if err != nil {
214 t.Fatal(err, out)
215 }
216 if out != SERVER {
217 t.Error(out)
218 }
219}
220
221func TestPacmanConfWithIncludesInSubdirectory(t *testing.T) {
222 tempDir := t.TempDir()

Callers

nothing calls this directly

Calls 2

ParseFunction · 0.92
GetServerMethod · 0.65

Tested by

no test coverage detected