MCPcopy Create free account
hub / github.com/segmentio/encoding / TestAppendToLower

Function TestAppendToLower

json/parse_test.go:96–133  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestAppendToLower(t *testing.T) {
97 tests := []string{
98 "",
99 "A",
100 "a",
101 "__segment_internal",
102 "someFieldWithALongBName",
103 "Hello World!",
104 "Hello\"World!",
105 "Hello\\World!",
106 "Hello\nWorld!",
107 "Hello\rWorld!",
108 "Hello\tWorld!",
109 "Hello\bWorld!",
110 "Hello\fWorld!",
111 "你好",
112 "<",
113 ">",
114 "&",
115 "\u001944",
116 "\u00c2e>",
117 "\u00c2V?",
118 "\u000e=8",
119 "\u001944\u00c2e>\u00c2V?\u000e=8",
120 "ir\u001bQJ\u007f\u0007y\u0015)",
121 }
122
123 for _, test := range tests {
124 s1 := strings.ToLower(test)
125 s2 := string(appendToLower(nil, []byte(test)))
126
127 if s1 != s2 {
128 t.Error("lowercase values mismatch")
129 t.Log("expected:", s1)
130 t.Log("found: ", s2)
131 }
132 }
133}
134
135func BenchmarkParseString(b *testing.B) {
136 s := []byte(`"__segment_internal"`)

Callers

nothing calls this directly

Calls 2

appendToLowerFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…