aboutsummaryrefslogtreecommitdiffhomepage
path: root/command/builder_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-08-07 18:57:01 +0900
committerOphestra <cat@gensokyo.uk>2026-08-07 18:57:01 +0900
commitb37c1d899349fef9e7af38940ae0c2d507c433a9 (patch)
tree5bc20683560d7fcd571d4587487bcf8575a4cf0b /command/builder_test.go
parent6a7f124debbeb4fb36be2b5373517f5677a635d4 (diff)
command: use NUL for magic usage string
This change also improves documentation. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'command/builder_test.go')
-rw-r--r--command/builder_test.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/command/builder_test.go b/command/builder_test.go
index 7b9a1701..05e29358 100644
--- a/command/builder_test.go
+++ b/command/builder_test.go
@@ -18,8 +18,14 @@ func TestBuild(t *testing.T) {
t.Run("direct zero length", func(t *testing.T) {
wantPanic := "invalid subcommand"
- t.Run("zero length name", func(t *testing.T) { defer checkRecover(t, "Command", wantPanic); c.Command("", "usage", stubHandler) })
- t.Run("zero length usage", func(t *testing.T) { defer checkRecover(t, "Command", wantPanic); c.Command("name", "", stubHandler) })
+ t.Run("zero length name", func(t *testing.T) {
+ defer checkRecover(t, "Command", wantPanic)
+ c.Command("", "usage", stubHandler)
+ })
+ t.Run("zero length usage", func(t *testing.T) {
+ defer checkRecover(t, "Command", wantPanic)
+ c.Command("name", "", stubHandler)
+ })
})
t.Run("direct adopt unique names", func(t *testing.T) {
@@ -34,8 +40,14 @@ func TestBuild(t *testing.T) {
t.Run("zero length", func(t *testing.T) {
wantPanic := "invalid subcommand tree"
- t.Run("zero length name", func(t *testing.T) { defer checkRecover(t, "New", wantPanic); c.New("", "usage") })
- t.Run("zero length usage", func(t *testing.T) { defer checkRecover(t, "New", wantPanic); c.New("name", "") })
+ t.Run("zero length name", func(t *testing.T) {
+ defer checkRecover(t, "New", wantPanic)
+ c.New("", "usage")
+ })
+ t.Run("zero length usage", func(t *testing.T) {
+ defer checkRecover(t, "New", wantPanic)
+ c.New("name", "")
+ })
})
t.Run("direct adopt unique names", func(t *testing.T) {