Artifact 9e573bd1faf7d9e85d530285889bb23ae365fe274d420790d387679c8bbd2488:
- File
internal/diff/diff_fuzz_test.go
— part of check-in
[f5744359d3]
at
2026-04-19 16:30:54
on branch trunk
— Initial open source release
libfossil is a pure-Go implementation of the Fossil SCM, reading and writing the same .fossil SQLite repository format as upstream Fossil.
This is the first public release of code that previously lived in a private repository. The module path is github.com/danmestas/libfossil and the binary is named libfossil to avoid $PATH collisions with upstream fossil.
Included: - Repo lifecycle (create, clone), checkout/checkin, timeline, merge, diff, annotate, shun, tag, branch, bisect, stash, undo/redo - Sync-over-HTTP protocol (client and handler) - Two SQLite drivers: modernc (pure Go, default) and ncruces (wasm-capable) - Observer interfaces (SyncObserver, CheckoutObserver) with an optional OpenTelemetry implementation in observer/otel (separate submodule) - Deterministic simulation testing harness with BUGGIFY fault injection - Kong-based embeddable CLI under cli/ and a standalone binary under cmd/libfossil/ (user: [email protected], size: 714) [annotate] [blame] [check-ins using]
package diff import "testing" func FuzzUnified(f *testing.F) { f.Add([]byte("a\nb\n"), []byte("a\nc\n")) f.Add([]byte(""), []byte("hello\n")) f.Add([]byte("hello\n"), []byte("")) f.Add([]byte("same\n"), []byte("same\n")) f.Add([]byte("\x00binary"), []byte("text\n")) f.Add([]byte("a\r\nb\r\n"), []byte("a\nb\n")) f.Fuzz(func(t *testing.T, a, b []byte) { // Must not panic (negative ContextLines is caught, but fuzz uses 3). _ = Unified(a, b, Options{ContextLines: 3}) stat := Stat(a, b) if stat.Binary { return } if stat.Insertions < 0 { t.Fatalf("negative insertions: %d", stat.Insertions) } if stat.Deletions < 0 { t.Fatalf("negative deletions: %d", stat.Deletions) } }) }