diff --git a/command/help_test.go b/command/help_test.go new file mode 100644 index 000000000..e5fbc8489 --- /dev/null +++ b/command/help_test.go @@ -0,0 +1,27 @@ +package command + +import ( + "testing" +) + +func TestStripIndent(t *testing.T) { + type c struct { + input string + expected string + } + + cases := []c{ + { + input: " --help Show help for command\n --version Show gh version", + expected: "--help Show help for command\n--version Show gh version\n", + }, + { + input: " --help Show help for command\n -R, --repo OWNER/REPO Select another repository using the OWNER/REPO format", + expected: " --help Show help for command\n-R, --repo OWNER/REPO Select another repository using the OWNER/REPO format", + }, + } + + for _, kase := range cases { + eq(t, stripIndent(kase.input), kase.expected) + } +}