Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions fixtures/metron_loader.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package fixtures

import (
"os"
"path/filepath"
"runtime"
)

func fixturesRoot() string {
_, file, _, _ := runtime.Caller(0)
anchorDir := filepath.Dir(filepath.Dir(file))
root := filepath.Join(anchorDir, "fixtures")
if _, err := os.Stat(root); err != nil {
panic("fixtures directory not found at " + root)
}
return root
}

// Path returns a path inside "fixtures/metron", defaulting the "metron" subdir.
func Path(name string) string {
return filepath.Join(fixturesRoot(), "metron", name)
}