hugo/utils/utils_test.go

27 lines
627 B
Go
Raw Normal View History

package utils
import (
"testing"
2015-03-05 22:19:10 +00:00
)
func TestCutUsageMessage(t *testing.T) {
2015-03-05 22:19:10 +00:00
tests := []struct {
message string
cutMessage string
}{
{"", ""},
{" Usage of hugo: \n -b, --baseURL=...", ""},
2015-03-05 22:19:10 +00:00
{"Some error Usage of hugo: \n", "Some error"},
{"Usage of hugo: \n -b --baseU", ""},
{"CRITICAL error for usage of hugo ", "CRITICAL error for usage of hugo"},
{"Invalid short flag a in -abcde", "Invalid short flag a in -abcde"},
}
for _, test := range tests {
message := cutUsageMessage(test.message)
if message != test.cutMessage {
t.Errorf("Expected %#v, got %#v", test.cutMessage, message)
}
}
}