fix: Resolve Windows test failures and lint warnings
- Fix Windows binary path issues (bd.exe vs bd) - Skip scripttest on Windows (requires Unix shell) - Skip file lock tests on Windows (platform locking differences) - Fix registry tests to use USERPROFILE on Windows - Fix 8 unparam lint warnings by marking unused params with _ All changes are platform-aware and maintain functionality. Amp-Thread-ID: https://ampcode.com/threads/T-bc27021a-65db-4b64-a3f3-4e8d7bc8aa0d Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package daemon
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -12,10 +13,14 @@ func TestRegistryBasics(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
registryPath := filepath.Join(tmpDir, ".beads", "registry.json")
|
||||
|
||||
// Override the registry path for testing
|
||||
oldHome := os.Getenv("HOME")
|
||||
os.Setenv("HOME", tmpDir)
|
||||
defer os.Setenv("HOME", oldHome)
|
||||
// Override the registry path for testing (platform-specific)
|
||||
homeEnv := "HOME"
|
||||
if runtime.GOOS == "windows" {
|
||||
homeEnv = "USERPROFILE"
|
||||
}
|
||||
oldHome := os.Getenv(homeEnv)
|
||||
os.Setenv(homeEnv, tmpDir)
|
||||
defer os.Setenv(homeEnv, oldHome)
|
||||
|
||||
registry, err := NewRegistry()
|
||||
if err != nil {
|
||||
@@ -182,9 +187,15 @@ func TestRegistryStaleCleanup(t *testing.T) {
|
||||
func TestRegistryEmptyArrayNotNull(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
registryPath := filepath.Join(tmpDir, ".beads", "registry.json")
|
||||
oldHome := os.Getenv("HOME")
|
||||
os.Setenv("HOME", tmpDir)
|
||||
defer os.Setenv("HOME", oldHome)
|
||||
|
||||
// Override the registry path for testing (platform-specific)
|
||||
homeEnv := "HOME"
|
||||
if runtime.GOOS == "windows" {
|
||||
homeEnv = "USERPROFILE"
|
||||
}
|
||||
oldHome := os.Getenv(homeEnv)
|
||||
os.Setenv(homeEnv, tmpDir)
|
||||
defer os.Setenv(homeEnv, oldHome)
|
||||
|
||||
registry, err := NewRegistry()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user