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

Function TestSplitLines

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

Source from the content-addressed store, hash-verified

443}
444
445func TestSplitLines(t *testing.T) {
446 allTests := []struct {
447 input string
448 want [][]byte
449 }{
450 {"foo", stringsToBytes("foo\n")},
451 {"foo\nbar", stringsToBytes("foo\n", "bar\n")},
452 {"foo\nbar\n", stringsToBytes("foo\n", "bar\n", "\n")},
453 }
454 for _, test := range allTests {
455 assertEqual(t, SplitLines([]byte(test.input)), test.want)
456 }
457}
458
459func benchmarkSplitLines(b *testing.B, count int) {
460 str := bytes.Repeat([]byte("foo\n"), count)

Callers

nothing calls this directly

Calls 3

stringsToBytesFunction · 0.85
assertEqualFunction · 0.70
SplitLinesFunction · 0.70

Tested by

no test coverage detected