Artifact f522d077f2f2e736f644196dd87564eb4245d5528f412ed7457461ad8da4e543:
- File
testutil/testutil_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: 713) [annotate] [blame] [check-ins using]
package testutil import ( "os" "testing" ) func TestNewTestRepo(t *testing.T) { tr := NewTestRepo(t) if _, err := os.Stat(tr.Path); err != nil { t.Fatalf("repo file does not exist: %v", err) } } func TestFossilRebuild(t *testing.T) { tr := NewTestRepo(t) tr.FossilRebuild(t) } func TestFossilSQL(t *testing.T) { tr := NewTestRepo(t) out := tr.FossilSQL(t, "SELECT count(*) FROM blob;") if out != "1" { t.Fatalf("FossilSQL count(*) = %q, want %q", out, "1") } } func TestFossilBinary(t *testing.T) { path := FossilBinary() if path == "" { t.Skip("fossil binary not found in PATH") } if _, err := os.Stat(path); err != nil { t.Fatalf("fossil binary not found at %q: %v", path, err) } }