mirror of
https://github.com/Twigpine/zero.git
synced 2026-11-09 05:19:33 -10:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecce5d9374 | ||
|
|
a053a6a8f0 |
No files matched your search
@@ -253,6 +253,7 @@ var commandDefinitions = []commandDefinition{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "/rewind",
|
name: "/rewind",
|
||||||
|
aliases: []string{"/undo"},
|
||||||
usage: "/rewind [latest|<sequence>]",
|
usage: "/rewind [latest|<sequence>]",
|
||||||
group: commandGroupSession,
|
group: commandGroupSession,
|
||||||
description: "Restore workspace files to a checkpoint and truncate the session.",
|
description: "Restore workspace files to a checkpoint and truncate the session.",
|
||||||
|
|||||||
@@ -985,6 +985,31 @@ func TestParseBackgroundTerminalCommands(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /undo is an alias for /rewind (issue #698): previously it fell through to
|
||||||
|
// commandUnknown.
|
||||||
|
func TestUndoAliasesRewind(t *testing.T) {
|
||||||
|
rewind, ok := resolveCommand("/rewind")
|
||||||
|
if !ok {
|
||||||
|
t.Fatal("expected /rewind to resolve")
|
||||||
|
}
|
||||||
|
alias, ok := resolveCommand("/undo")
|
||||||
|
if !ok || alias.kind != rewind.kind {
|
||||||
|
t.Fatalf("expected /undo to alias /rewind, got ok=%v command=%#v", ok, alias)
|
||||||
|
}
|
||||||
|
// End-to-end: a typed /undo dispatches to the rewind handler with args intact,
|
||||||
|
// for both the "latest" and numeric-<sequence> forms of the /rewind contract.
|
||||||
|
if parsed := parseCommand("/undo latest"); parsed.kind != commandRewind || parsed.text != "latest" {
|
||||||
|
t.Fatalf("parseCommand(%q) = %#v, want commandRewind with text=latest", "/undo latest", parsed)
|
||||||
|
}
|
||||||
|
if parsed := parseCommand("/undo 123"); parsed.kind != commandRewind || parsed.text != "123" {
|
||||||
|
t.Fatalf("parseCommand(%q) = %#v, want commandRewind with text=123", "/undo 123", parsed)
|
||||||
|
}
|
||||||
|
// Guard: without the alias it would be commandUnknown.
|
||||||
|
if parsed := parseCommand("/undo"); parsed.kind == commandUnknown {
|
||||||
|
t.Fatal("/undo resolved to commandUnknown — the alias is not wired")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestCommandSelectionRequiresInputFromUsage(t *testing.T) {
|
func TestCommandSelectionRequiresInputFromUsage(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
name string
|
name string
|
||||||
|
|||||||
Reference in new issue
Block a user