28 lines
484 B
Go
28 lines
484 B
Go
package forward
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestEnvFileCandidates_includesCWDAndProgramDir(t *testing.T) {
|
|
wd, err := os.Getwd()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
cands := envFileCandidates()
|
|
if len(cands) < 2 {
|
|
t.Fatalf("expected multiple candidates, got %v", cands)
|
|
}
|
|
foundCWD := false
|
|
for _, p := range cands {
|
|
if p == filepath.Join(wd, ".env") {
|
|
foundCWD = true
|
|
}
|
|
}
|
|
if !foundCWD {
|
|
t.Fatalf("CWD .env not in candidates: %v", cands)
|
|
}
|
|
}
|