diff

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package diff parses git diff output to identify changed lines for incremental mutation testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	StartLine int
	EndLine   int
}

Change represents a contiguous range of changed lines in a file.

type Diff

type Diff map[FileName][]Change

Diff maps file names to their list of changes.

func New

func New() (Diff, error)

New creates a new Diff by parsing git diff output using the default command executor.

func NewWithCmd

func NewWithCmd[T execCmd](cmdContext func(name string, args ...string) T) (Diff, error)

NewWithCmd creates a new Diff by parsing git diff output using a custom command executor. This is useful for testing.

func (Diff) IsChanged

func (d Diff) IsChanged(pos token.Position) bool

IsChanged returns true if the given position is within a changed region. If the diff is empty, it returns true for all positions.

type FileName

type FileName string

FileName represents a file path in a diff.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL