scantest

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package scantest exposes utilities for testing the codescan packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertArrayProperty

func AssertArrayProperty(t *testing.T, schema *oaispec.Schema, typeName, jsonName, format, goName string)

func AssertArrayRef

func AssertArrayRef(t *testing.T, schema *oaispec.Schema, jsonName, goName, fragment string)

func AssertProperty

func AssertProperty(t *testing.T, schema *oaispec.Schema, typeName, jsonName, format, goName string)

func AssertRef

func AssertRef(t *testing.T, schema *oaispec.Schema, jsonName, _, fragment string)

func CompareOrDumpJSON

func CompareOrDumpJSON(t *testing.T, got any, name string)

CompareOrDumpJSON marshals got to stable JSON and either writes it to <repo>/fixtures/integration/golden/<name> (when UPDATE_GOLDEN=1) or asserts that it JSON-equals the stored golden.

This is the regression-testing harness used to detect any behavior change in the go-openapi/spec objects produced by the scanner, compared against a captured baseline.

Golden files are named by content (fixture bundle + object kind + entity), not by test name, so they survive test reshuffling.

func FixturesDir

func FixturesDir() string

FixturesDir returns the absolute path to the repo-level fixtures/ directory, so tests can run from any package depth without fragile relative paths.

func LoadClassificationPkgsCtx

func LoadClassificationPkgsCtx(t *testing.T) *scanner.ScanCtx

func LoadGo118ClassificationPkgsCtx

func LoadGo118ClassificationPkgsCtx(t *testing.T) *scanner.ScanCtx

func LoadPetstorePkgsCtx

func LoadPetstorePkgsCtx(t testing.TB, enableDebug bool) *scanner.ScanCtx

Types

This section is empty.

Directories

Path Synopsis
Package mocks contains mock types for all interfaces.
Package mocks contains mock types for all interfaces.

Jump to

Keyboard shortcuts

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