MCPcopy
hub / github.com/jesseduffield/lazygit / TestGetNextStageableLineIndex

Function TestGetNextStageableLineIndex

pkg/commands/patch/patch_test.go:630–656  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

628}
629
630func TestGetNextStageableLineIndex(t *testing.T) {
631 type scenario struct {
632 testName string
633 patchStr string
634 indexes []int
635 expecteds []int
636 }
637
638 scenarios := []scenario{
639 {
640 testName: "twoHunks",
641 patchStr: twoHunks,
642 indexes: []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 1000},
643 expecteds: []int{6, 6, 6, 6, 6, 6, 6, 7, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16},
644 },
645 }
646
647 for _, s := range scenarios {
648 t.Run(s.testName, func(t *testing.T) {
649 for i, idx := range s.indexes {
650 patch := Parse(s.patchStr)
651 result := patch.GetNextChangeIdx(idx)
652 assert.Equal(t, s.expecteds[i], result)
653 }
654 })
655 }
656}
657
658func TestAdjustLineNumber(t *testing.T) {
659 type scenario struct {

Callers

nothing calls this directly

Calls 3

ParseFunction · 0.85
GetNextChangeIdxMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected