Register validated commands without registry copies

This commit is contained in:
2026-10-09 01:32:36 +00:00
parent 3f8841f298
commit 5816dd3eb9
3 changed files with 50 additions and 10 deletions

View File

@@ -159,6 +159,12 @@ func TestRegisterBatchIsAtomicAndRejectsReservedPaths(t *testing.T) {
if _, exists := app.commands["added"]; exists {
t.Fatal("failed batch attached a partial registration")
}
if err := app.Register(added, added); err == nil {
t.Fatal("Register accepted a duplicate within a batch")
}
if _, exists := app.commands["added"]; exists {
t.Fatal("failed duplicate batch attached a registration")
}
for _, name := range []string{"help", "version"} {
reserved, err := NewCommand(CommandSpec[struct{}]{Name: name})
if err != nil {