Add polecat session cycling (C-b n/p)
Polecats for a rig now cycle among themselves, like crew members. Session groups are now: - Town: Mayor ↔ Deacon - Crew: All crew in same rig - Rig infra: Witness ↔ Refinery - Polecats: All polecats in same rig 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
118
internal/cmd/polecat_cycle_test.go
Normal file
118
internal/cmd/polecat_cycle_test.go
Normal file
@@ -0,0 +1,118 @@
|
||||
package cmd
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParsePolecatSessionName(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
sessionName string
|
||||
wantRig string
|
||||
wantPolecat string
|
||||
wantOk bool
|
||||
}{
|
||||
// Valid polecat sessions
|
||||
{
|
||||
name: "simple polecat",
|
||||
sessionName: "gt-gastown-Toast",
|
||||
wantRig: "gastown",
|
||||
wantPolecat: "Toast",
|
||||
wantOk: true,
|
||||
},
|
||||
{
|
||||
name: "another polecat",
|
||||
sessionName: "gt-gastown-Nux",
|
||||
wantRig: "gastown",
|
||||
wantPolecat: "Nux",
|
||||
wantOk: true,
|
||||
},
|
||||
{
|
||||
name: "polecat in different rig",
|
||||
sessionName: "gt-beads-Worker",
|
||||
wantRig: "beads",
|
||||
wantPolecat: "Worker",
|
||||
wantOk: true,
|
||||
},
|
||||
{
|
||||
name: "polecat with hyphen in name",
|
||||
sessionName: "gt-gastown-Max-01",
|
||||
wantRig: "gastown",
|
||||
wantPolecat: "Max-01",
|
||||
wantOk: true,
|
||||
},
|
||||
|
||||
// Not polecat sessions (should return false)
|
||||
{
|
||||
name: "crew session",
|
||||
sessionName: "gt-gastown-crew-jack",
|
||||
wantRig: "",
|
||||
wantPolecat: "",
|
||||
wantOk: false,
|
||||
},
|
||||
{
|
||||
name: "witness session",
|
||||
sessionName: "gt-gastown-witness",
|
||||
wantRig: "",
|
||||
wantPolecat: "",
|
||||
wantOk: false,
|
||||
},
|
||||
{
|
||||
name: "refinery session",
|
||||
sessionName: "gt-gastown-refinery",
|
||||
wantRig: "",
|
||||
wantPolecat: "",
|
||||
wantOk: false,
|
||||
},
|
||||
{
|
||||
name: "mayor session",
|
||||
sessionName: "gt-mayor",
|
||||
wantRig: "",
|
||||
wantPolecat: "",
|
||||
wantOk: false,
|
||||
},
|
||||
{
|
||||
name: "deacon session",
|
||||
sessionName: "gt-deacon",
|
||||
wantRig: "",
|
||||
wantPolecat: "",
|
||||
wantOk: false,
|
||||
},
|
||||
{
|
||||
name: "no gt prefix",
|
||||
sessionName: "gastown-Toast",
|
||||
wantRig: "",
|
||||
wantPolecat: "",
|
||||
wantOk: false,
|
||||
},
|
||||
{
|
||||
name: "empty string",
|
||||
sessionName: "",
|
||||
wantRig: "",
|
||||
wantPolecat: "",
|
||||
wantOk: false,
|
||||
},
|
||||
{
|
||||
name: "just gt prefix",
|
||||
sessionName: "gt-",
|
||||
wantRig: "",
|
||||
wantPolecat: "",
|
||||
wantOk: false,
|
||||
},
|
||||
{
|
||||
name: "no name after rig",
|
||||
sessionName: "gt-gastown-",
|
||||
wantRig: "",
|
||||
wantPolecat: "",
|
||||
wantOk: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
gotRig, gotPolecat, gotOk := parsePolecatSessionName(tt.sessionName)
|
||||
if gotRig != tt.wantRig || gotPolecat != tt.wantPolecat || gotOk != tt.wantOk {
|
||||
t.Errorf("parsePolecatSessionName(%q) = (%q, %q, %v), want (%q, %q, %v)",
|
||||
tt.sessionName, gotRig, gotPolecat, gotOk, tt.wantRig, tt.wantPolecat, tt.wantOk)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user