-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnormalize_test.go
More file actions
34 lines (27 loc) · 823 Bytes
/
Copy pathnormalize_test.go
File metadata and controls
34 lines (27 loc) · 823 Bytes
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
29
30
31
32
33
34
package logfjournald
import (
"testing"
"github.com/ssgreg/logf"
"github.com/stretchr/testify/require"
)
type testCase struct {
Name string
Testing string
Golden string
}
func TestAppendNormalizedKey(t *testing.T) {
testCases := []testCase{
{"NoChanges", "ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789", "ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789"},
{"StartWithUnderscore", "_F", "LOGF_F"},
{"StartWithInvalidChar", "!F", "LOGF_F"},
{"Uppercasing", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
{"InvalidChars", "!@#$%^&*()-=\n\r\a<>?ГЗ:;'\\|?.,~[]{}", "LOGF_________________________________"},
}
for _, tc := range testCases {
t.Run(tc.Name, func(t *testing.T) {
b := logf.NewBuffer()
appendNormalizedKey(b, tc.Testing)
require.EqualValues(t, tc.Golden, b.String())
})
}
}