hugo/utils/utils_test.go
Anthony Fok 82a0888995 Revert "Expansion of unit tests for utils/utils.go"
Rationale: Test failing on Windows with errors like this:

    utils_test.go:177: Error: Could not remove file "f".
    Error: remove C:\Users\appveyor\AppData\Local\Temp\utils_test_747965610:
    The process cannot access the file because it is being used by another
    process.

This reverts commit 6b28e38cea.

Sorry for my premature merge of Pull Request #818.
2015-02-17 03:35:23 -07:00

28 lines
696 B
Go

package utils
import (
"testing"
)
func TestCutUsageMessage(t *testing.T) {
tests := []struct{
message string
cutMessage string
}{
{"", ""},
{" Usage of hugo: \n -b, --baseUrl=...", ""},
{"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)
}
}
}