MCPcopy
hub / github.com/prometheus/client_golang / TestWithAsciiBJunk

Function TestWithAsciiBJunk

prometheus/internal/difflib_test.go:178–196  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

176}
177
178func TestWithAsciiBJunk(t *testing.T) {
179 isJunk := func(s string) bool {
180 return s == " "
181 }
182 sm := NewMatcherWithJunk(splitChars(rep("a", 40)+rep("b", 40)),
183 splitChars(rep("a", 44)+rep("b", 40)), true, isJunk)
184 assertEqual(t, sm.bJunk, map[string]struct{}{})
185
186 sm = NewMatcherWithJunk(splitChars(rep("a", 40)+rep("b", 40)),
187 splitChars(rep("a", 44)+rep("b", 40)+rep(" ", 20)), false, isJunk)
188 assertEqual(t, sm.bJunk, map[string]struct{}{" ": {}})
189
190 isJunk = func(s string) bool {
191 return s == " " || s == "b"
192 }
193 sm = NewMatcherWithJunk(splitChars(rep("a", 40)+rep("b", 40)),
194 splitChars(rep("a", 44)+rep("b", 40)+rep(" ", 20)), false, isJunk)
195 assertEqual(t, sm.bJunk, map[string]struct{}{" ": {}, "b": {}})
196}
197
198func TestSFBugsRatioForNullSeqn(t *testing.T) {
199 sm := NewMatcher(nil, nil)

Callers

nothing calls this directly

Calls 4

NewMatcherWithJunkFunction · 0.85
splitCharsFunction · 0.85
repFunction · 0.85
assertEqualFunction · 0.85

Tested by

no test coverage detected