testkit

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testkit provides test helpers for component modules and external plugins: fuzz-target invariants, Go binary builders for fake tools, and lockfile position assertions.

Index

Constants

View Source
const MaxFuzzInputSize = 1 << 20

MaxFuzzInputSize is the shared upper bound for parser fuzz payloads.

Variables

This section is empty.

Functions

func BuildGoBinary

func BuildGoBinary(t testing.TB, outputPath, source string) error

BuildGoBinary writes source to a temporary file and builds it into outputPath.

func BuildGoBinaryFromSource

func BuildGoBinaryFromSource(outputPath, source string) error

BuildGoBinaryFromSource is BuildGoBinary for callers without a testing handle — package TestMain functions that build shared fake binaries once. It manages its own temporary source directory.

func RequireFuzzGraphValid

func RequireFuzzGraphValid(t *testing.T, graph *sdk.Graph)

RequireFuzzGraphValid verifies the minimum invariants of a successfully parsed dependency graph.

func RequireLockfilePositions

func RequireLockfilePositions(t *testing.T, detector sdk.Detector, fixtureDir string, wantPositionKeys []string)

RequireLockfilePositions resolves fixtureDir with the given detector and asserts that every named package in the resolved graph carries at least one non-empty source position (a location whose Position names a file and a 1-based line). It is the per-detector replacement for the Bomly CLI's cross-detector position test: each detector module keeps its own lockfile fixture and asserts its own position extraction with one call.

wantPositionKeys entries are graph node IDs, typically "name@version" (or "org:name@version" for org-scoped ecosystems). A missing node or a node without a position fails the test with the offending key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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