testutil

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testutil provides test utilities and fixtures for unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDetailedOAS2Document

func NewDetailedOAS2Document() *parser.OAS2Document

NewDetailedOAS2Document creates a complete OAS 2.0 document with common features for testing. Includes paths, operations, schemas, and definitions.

func NewDetailedOAS3Document

func NewDetailedOAS3Document() *parser.OAS3Document

NewDetailedOAS3Document creates a complete OAS 3.x document with common features for testing. Includes paths, operations, schemas, and components.

func NewSimpleOAS2Document

func NewSimpleOAS2Document() *parser.OAS2Document

NewSimpleOAS2Document creates a minimal OAS 2.0 document for testing. Contains only required fields: swagger, info, host, basePath, schemes, paths.

func NewSimpleOAS3Document

func NewSimpleOAS3Document() *parser.OAS3Document

NewSimpleOAS3Document creates a minimal OAS 3.x document for testing. Contains only required fields: openapi, info, paths, servers.

func WriteTempJSON

func WriteTempJSON(t *testing.T, doc interface{}) string

WriteTempJSON marshals a document to JSON and writes it to a temporary file. Returns the path to the temporary file. The file is automatically cleaned up when the test completes (via t.TempDir).

func WriteTempYAML

func WriteTempYAML(t *testing.T, doc interface{}) string

WriteTempYAML marshals a document to YAML and writes it to a temporary file. Returns the path to the temporary file. The file is automatically cleaned up when the test completes (via t.TempDir).

Types

This section is empty.

Jump to

Keyboard shortcuts

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