summaryrefslogtreecommitdiffstats
path: root/helpers/general_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/general_test.go')
-rw-r--r--helpers/general_test.go25
1 files changed, 23 insertions, 2 deletions
diff --git a/helpers/general_test.go b/helpers/general_test.go
index 1279df439..ed4c3d2c2 100644
--- a/helpers/general_test.go
+++ b/helpers/general_test.go
@@ -1,4 +1,4 @@
-// Copyright 2018 The Hugo Authors. All rights reserved.
+// Copyright 2019 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ func TestGuessType(t *testing.T) {
{"html", "html"},
{"htm", "html"},
{"org", "org"},
- {"excel", "unknown"},
+ {"excel", ""},
} {
result := GuessType(this.in)
if result != this.expect {
@@ -166,6 +166,27 @@ var containsAdditionalTestData = []struct {
{"", []byte(""), false},
}
+func TestSliceToLower(t *testing.T) {
+ t.Parallel()
+ tests := []struct {
+ value []string
+ expected []string
+ }{
+ {[]string{"a", "b", "c"}, []string{"a", "b", "c"}},
+ {[]string{"a", "B", "c"}, []string{"a", "b", "c"}},
+ {[]string{"A", "B", "C"}, []string{"a", "b", "c"}},
+ }
+
+ for _, test := range tests {
+ res := SliceToLower(test.value)
+ for i, val := range res {
+ if val != test.expected[i] {
+ t.Errorf("Case mismatch. Expected %s, got %s", test.expected[i], res[i])
+ }
+ }
+ }
+}
+
func TestReaderContains(t *testing.T) {
for i, this := range append(containsBenchTestData, containsAdditionalTestData...) {
result := ReaderContains(strings.NewReader(this.v1), this.v2)