add TestStripIndent

This commit is contained in:
Shi Han NG 2020-07-16 08:33:00 +09:00
parent c7df292288
commit 7120b95731
No known key found for this signature in database
GPG key ID: 09FC1637248554BD

27
command/help_test.go Normal file
View file

@ -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)
}
}