MCPcopy Create free account
hub / github.com/cogentcore/core / TestWithAsciiBJunk

Function TestWithAsciiBJunk

texteditor/difflib/bytes/bytes_test.go:286–304  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

284}
285
286func TestWithAsciiBJunk(t *testing.T) {
287 isJunk := func(s []byte) bool {
288 return len(s) == 1 && s[0] == ' '
289 }
290 sm := NewMatcherWithJunk(splitChars(rep("a", 40)+rep("b", 40)),
291 splitChars(rep("a", 44)+rep("b", 40)), true, isJunk)
292 assertEqual(t, getall(&sm.b2j, lineJUNK), [][]byte{})
293
294 sm = NewMatcherWithJunk(splitChars(rep("a", 40)+rep("b", 40)),
295 splitChars(rep("a", 44)+rep("b", 40)+rep(" ", 20)), false, isJunk)
296 assertEqual(t, getall(&sm.b2j, lineJUNK), [][]byte{SPACE})
297
298 isJunk = func(s []byte) bool {
299 return len(s) == 1 && (s[0] == ' ' || s[0] == 'b')
300 }
301 sm = NewMatcherWithJunk(splitChars(rep("a", 40)+rep("b", 40)),
302 splitChars(rep("a", 44)+rep("b", 40)+rep(" ", 20)), false, isJunk)
303 assertEqual(t, getall(&sm.b2j, lineJUNK), [][]byte{{'b'}, SPACE})
304}
305
306func TestSFBugsRatioForNullSeqn(t *testing.T) {
307 sm := NewMatcher(nil, nil)

Callers

nothing calls this directly

Calls 5

getallFunction · 0.85
NewMatcherWithJunkFunction · 0.70
splitCharsFunction · 0.70
repFunction · 0.70
assertEqualFunction · 0.70

Tested by

no test coverage detected