testing

package
v1.0.27 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 9 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockCachePolicy

type MockCachePolicy struct {
	CacheTime int
	Headers   map[string]string
}

MockCachePolicy is a configurable cache policy for testing.

func NewMockCachePolicy

func NewMockCachePolicy(cacheTime int) *MockCachePolicy

NewMockCachePolicy creates a new mock cache policy.

func (*MockCachePolicy) GetCacheHeaders

func (p *MockCachePolicy) GetCacheHeaders(path string) map[string]string

GetCacheHeaders returns the configured headers.

func (*MockCachePolicy) GetCacheTime

func (p *MockCachePolicy) GetCacheTime(path string) int

GetCacheTime returns the configured cache time.

type MockFallbackStrategy

type MockFallbackStrategy struct {
	ShouldFallbackFunc func(path string) bool
	FallbackPathFunc   func(path string) string
}

MockFallbackStrategy is a configurable fallback strategy for testing.

func NewMockFallbackStrategy

func NewMockFallbackStrategy(shouldFallback func(string) bool, fallbackPath func(string) string) *MockFallbackStrategy

NewMockFallbackStrategy creates a new mock fallback strategy.

func (*MockFallbackStrategy) GetFallbackPath

func (s *MockFallbackStrategy) GetFallbackPath(path string) string

GetFallbackPath returns the fallback path.

func (*MockFallbackStrategy) ShouldFallback

func (s *MockFallbackStrategy) ShouldFallback(path string) bool

ShouldFallback returns whether fallback should be used.

type MockFileSystemProvider

type MockFileSystemProvider struct {
	// contains filtered or unexported fields
}

MockFileSystemProvider is an in-memory filesystem provider for testing.

func NewMockProvider

func NewMockProvider(files map[string][]byte) *MockFileSystemProvider

NewMockProvider creates a new in-memory provider with the given files. Keys should be slash-separated paths (e.g., "index.html", "assets/app.js").

func (*MockFileSystemProvider) AddFile

func (m *MockFileSystemProvider) AddFile(name string, data []byte)

AddFile adds a file to the in-memory filesystem.

func (*MockFileSystemProvider) Close

func (m *MockFileSystemProvider) Close() error

Close marks the provider as closed.

func (*MockFileSystemProvider) Open

func (m *MockFileSystemProvider) Open(name string) (fs.File, error)

Open opens a file from the in-memory filesystem.

func (*MockFileSystemProvider) RemoveFile

func (m *MockFileSystemProvider) RemoveFile(name string)

RemoveFile removes a file from the in-memory filesystem.

func (*MockFileSystemProvider) Type

func (m *MockFileSystemProvider) Type() string

Type returns "mock".

type MockMIMEResolver

type MockMIMEResolver struct {
	// contains filtered or unexported fields
}

MockMIMEResolver is a configurable MIME resolver for testing.

func NewMockMIMEResolver

func NewMockMIMEResolver() *MockMIMEResolver

NewMockMIMEResolver creates a new mock MIME resolver.

func (*MockMIMEResolver) GetMIMEType

func (r *MockMIMEResolver) GetMIMEType(path string) string

GetMIMEType returns the MIME type for the given path.

func (*MockMIMEResolver) RegisterMIMEType

func (r *MockMIMEResolver) RegisterMIMEType(extension, mimeType string)

RegisterMIMEType registers a MIME type.

Jump to

Keyboard shortcuts

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