fuzzing

package
v0.153.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fuzzing holds what the fuzz targets share: finding the documents they seed their corpus with, and telling which documents survive YAML.

Index

Constants

View Source
const MaxSize = 16 << 10

MaxSize keeps the seed corpus small enough that `go test ./...` still replays it on every run without noticeably slowing the suite down.

Variables

This section is empty.

Functions

func APIsGuru

func APIsGuru(tb testing.TB, testdata, marker string) [][]byte

APIsGuru returns the documents of the APIs-guru corpus under testdata whose top-level keys include marker, e.g. "openapi:" or "swagger:". The corpus is downloaded by the TestV{2,3}ApisGuruOpenapiDirectory tests, and when it is absent this returns nothing. Under -short, which skips those tests, it returns nothing either, keeping the short suite short.

func LosesInYAML

func LosesInYAML(v any) bool

LosesInYAML reports whether v, decoded from JSON, holds something the YAML emitter does not write back faithfully, so a round trip through YAML text cannot be expected to preserve it:

  • a "<<" key, which is written unquoted and so reads back as a merge;
  • a string starting with a line break, which is written as a block scalar that drops it.

func Testdata

func Testdata(tb testing.TB, roots ...string) [][]byte

Testdata returns every spec under the given testdata roots, however deep, so documents kept beside the tests that load them seed the fuzzers too. Fuzz corpora are skipped, and so is the downloaded APIs-guru directory, which APIsGuru reads.

Types

This section is empty.

Jump to

Keyboard shortcuts

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