ttscontract

package
v0.76.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 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 ttscontract provides a reusable conformance suite that every tts.Provider implementation is expected to satisfy.

Like its STT sibling, it centralises the cross-provider invariants — stable identity, a valid deployment Kind, provider-stamped non-empty audio results, HTTP-error propagation, and context cancellation — so a provider test only supplies a constructor and a success-response handler, then calls RunContract.

The harness lives in a non-test package so it can be shared across provider packages. Conformance tests must live in an external test package (e.g. `package tts_test`) to avoid the import cycle that would form (ttscontract imports tts).

Stability: Beta — API-checked; may change with a changelog callout.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunContract

func RunContract(t *testing.T, c Case)

RunContract executes the full TTS conformance suite for c.

Types

type Case

type Case struct {
	// Name is a short label used to namespace the subtests (e.g. "openai").
	Name string

	// ExpectedName is the stable identifier the provider must return from
	// Name() and stamp onto Result.Provider for a successful synthesis.
	ExpectedName string

	// NewProvider builds the provider bound to baseURL, an httptest server URL.
	// The provider must be configured to accept that loopback URL (relaxed
	// netsec validation).
	NewProvider func(baseURL string) tts.Provider

	// Success serves exactly one successful synthesis response in the
	// provider's wire format (raw audio bytes or a JSON envelope).
	Success http.HandlerFunc
}

Case describes a single TTS provider under conformance test.

Jump to

Keyboard shortcuts

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