MCPcopy
hub / github.com/mum4k/termdash / TestIsPartial

Function TestIsPartial

private/canvas/buffer/buffer_test.go:489–584  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

487}
488
489func TestIsPartial(t *testing.T) {
490 tests := []struct {
491 desc string
492 buffer Buffer
493 point image.Point
494 want bool
495 wantErr bool
496 }{
497 {
498 desc: "point falls before the buffer",
499 buffer: mustNew(image.Point{1, 1}),
500 point: image.Point{-1, -1},
501 wantErr: true,
502 },
503 {
504 desc: "point falls after the buffer",
505 buffer: mustNew(image.Point{1, 1}),
506 point: image.Point{1, 1},
507 wantErr: true,
508 },
509 {
510 desc: "the first cell cannot be partial",
511 buffer: mustNew(image.Point{1, 1}),
512 point: image.Point{0, 0},
513 want: false,
514 },
515 {
516 desc: "previous cell on the same line contains no rune",
517 buffer: mustNew(image.Point{3, 3}),
518 point: image.Point{1, 0},
519 want: false,
520 },
521 {
522 desc: "previous cell on the same line contains half-width rune",
523 buffer: func() Buffer {
524 b := mustNew(image.Point{3, 3})
525 b[0][0].Rune = 'A'
526 return b
527 }(),
528 point: image.Point{1, 0},
529 want: false,
530 },
531 {
532 desc: "previous cell on the same line contains full-width rune",
533 buffer: func() Buffer {
534 b := mustNew(image.Point{3, 3})
535 b[0][0].Rune = '世'
536 return b
537 }(),
538 point: image.Point{1, 0},
539 want: true,
540 },
541 {
542 desc: "previous cell on previous line contains no rune",
543 buffer: mustNew(image.Point{3, 3}),
544 point: image.Point{0, 1},
545 want: false,
546 },

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
IsPartialMethod · 0.80
mustNewFunction · 0.70

Tested by

no test coverage detected