testutil

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package testutil provides shared test helpers for the oCMS project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MinimalThemeFuncMap added in v0.9.0

func MinimalThemeFuncMap() template.FuncMap

MinimalThemeFuncMap returns the minimal template functions needed to parse theme templates in tests. Use this in any test that creates a theme.Manager and calls LoadThemes or SetFuncMap.

func TestDB

func TestDB(t *testing.T) (*sql.DB, func())

TestDB creates a temporary test database with core migrations applied. Returns the database and a cleanup function that should be deferred.

func TestLogger

func TestLogger() *slog.Logger

TestLogger creates a silent test logger that only outputs warnings and errors.

func TestLoggerSilent

func TestLoggerSilent() *slog.Logger

TestLoggerSilent creates a completely silent test logger (error level only).

func TestMemoryDB

func TestMemoryDB(t *testing.T) *sql.DB

TestMemoryDB creates an in-memory SQLite database for testing. Useful for tests that don't need persistent storage or migrations.

Types

This section is empty.

Directories

Path Synopsis
Package moduleutil provides module-specific test helpers for the oCMS project.
Package moduleutil provides module-specific test helpers for the oCMS project.

Jump to

Keyboard shortcuts

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