Files
xk-hy-forward-go/internal/forward/env_test.go
2026-05-22 08:42:27 +08:00

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)
}
}