Welcome to mirror list, hosted at ThFree Co, Russian Federation.

utils_test.go « utils - github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0bb92dea847ea5e932c836c11ec8053ee150a45a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
		}
	}
}