Fixing unit tests on windows (#813)
* Add Windows stub for orphan cleanup * Fix account switch tests on Windows * Make query session events test portable * Disable beads daemon in query session events test * Add Windows bd stubs for sling tests * Make expandOutputPath test OS-agnostic * Make role_agents test Windows-friendly * Make config path tests OS-agnostic * Make HealthCheckStateFile test OS-agnostic * Skip orphan process check on Windows * Normalize sparse checkout detail paths * Make dog path tests OS-agnostic * Fix bare repo refspec config on Windows * Add Windows process detection for locks * Add Windows CI workflow * Make mail path tests OS-agnostic * Skip plugin file mode test on Windows * Skip tmux-dependent polecat tests on Windows * Normalize polecat paths and AGENTS.md content * Make beads init failure test Windows-friendly * Skip rig agent bead init test on Windows * Make XDG path tests OS-agnostic * Make exec tests portable on Windows * Adjust atomic write tests for Windows * Make wisp tests Windows-friendly * Make workspace find tests OS-agnostic * Fix Windows rig add integration test * Make sling var logging Windows-friendly * Fix sling attached molecule update ordering --------- Co-authored-by: Johann Dirry <johann.dirry@microsea.at>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/steveyegge/gastown/internal/git"
|
||||
@@ -121,7 +122,7 @@ func TestPolecatDir(t *testing.T) {
|
||||
|
||||
dir := m.polecatDir("Toast")
|
||||
expected := "/home/user/ai/test-rig/polecats/Toast"
|
||||
if dir != expected {
|
||||
if filepath.ToSlash(dir) != expected {
|
||||
t.Errorf("polecatDir = %q, want %q", dir, expected)
|
||||
}
|
||||
}
|
||||
@@ -354,8 +355,10 @@ func TestAddWithOptions_HasAgentsMD(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("read worktree AGENTS.md: %v", err)
|
||||
}
|
||||
if string(content) != string(agentsMDContent) {
|
||||
t.Errorf("AGENTS.md content = %q, want %q", string(content), string(agentsMDContent))
|
||||
gotContent := strings.ReplaceAll(string(content), "\r\n", "\n")
|
||||
wantContent := strings.ReplaceAll(string(agentsMDContent), "\r\n", "\n")
|
||||
if gotContent != wantContent {
|
||||
t.Errorf("AGENTS.md content = %q, want %q", gotContent, wantContent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,8 +440,10 @@ func TestAddWithOptions_AgentsMDFallback(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("read worktree AGENTS.md: %v", err)
|
||||
}
|
||||
if string(content) != string(agentsMDContent) {
|
||||
t.Errorf("AGENTS.md content = %q, want %q", string(content), string(agentsMDContent))
|
||||
gotContent := strings.ReplaceAll(string(content), "\r\n", "\n")
|
||||
wantContent := strings.ReplaceAll(string(agentsMDContent), "\r\n", "\n")
|
||||
if gotContent != wantContent {
|
||||
t.Errorf("AGENTS.md content = %q, want %q", gotContent, wantContent)
|
||||
}
|
||||
}
|
||||
// TestReconcilePoolWith tests all permutations of directory and session existence.
|
||||
|
||||
@@ -2,7 +2,9 @@ package polecat
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -10,6 +12,17 @@ import (
|
||||
"github.com/steveyegge/gastown/internal/tmux"
|
||||
)
|
||||
|
||||
func requireTmux(t *testing.T) {
|
||||
t.Helper()
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("tmux not supported on Windows")
|
||||
}
|
||||
if _, err := exec.LookPath("tmux"); err != nil {
|
||||
t.Skip("tmux not installed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSessionName(t *testing.T) {
|
||||
r := &rig.Rig{
|
||||
Name: "gastown",
|
||||
@@ -33,7 +46,7 @@ func TestSessionManagerPolecatDir(t *testing.T) {
|
||||
|
||||
dir := m.polecatDir("Toast")
|
||||
expected := "/home/user/ai/gastown/polecats/Toast"
|
||||
if dir != expected {
|
||||
if filepath.ToSlash(dir) != expected {
|
||||
t.Errorf("polecatDir = %q, want %q", dir, expected)
|
||||
}
|
||||
}
|
||||
@@ -79,6 +92,8 @@ func TestStartPolecatNotFound(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIsRunningNoSession(t *testing.T) {
|
||||
requireTmux(t)
|
||||
|
||||
r := &rig.Rig{
|
||||
Name: "gastown",
|
||||
Polecats: []string{"Toast"},
|
||||
@@ -95,6 +110,8 @@ func TestIsRunningNoSession(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionManagerListEmpty(t *testing.T) {
|
||||
requireTmux(t)
|
||||
|
||||
r := &rig.Rig{
|
||||
Name: "test-rig-unlikely-name",
|
||||
Polecats: []string{},
|
||||
@@ -111,6 +128,8 @@ func TestSessionManagerListEmpty(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStopNotFound(t *testing.T) {
|
||||
requireTmux(t)
|
||||
|
||||
r := &rig.Rig{
|
||||
Name: "test-rig",
|
||||
Polecats: []string{"Toast"},
|
||||
@@ -124,6 +143,8 @@ func TestStopNotFound(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCaptureNotFound(t *testing.T) {
|
||||
requireTmux(t)
|
||||
|
||||
r := &rig.Rig{
|
||||
Name: "test-rig",
|
||||
Polecats: []string{"Toast"},
|
||||
@@ -137,6 +158,8 @@ func TestCaptureNotFound(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInjectNotFound(t *testing.T) {
|
||||
requireTmux(t)
|
||||
|
||||
r := &rig.Rig{
|
||||
Name: "test-rig",
|
||||
Polecats: []string{"Toast"},
|
||||
|
||||
Reference in New Issue
Block a user