testutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT 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

Overview

Package testutil provides shared, dependency-light helpers for tests across the mnemos packages: a migrated temp database, file creation, a silent logger, and a working-directory switch. It imports only internal/storage, so white-box (internal) test packages such as internal/ingest can use it without creating an import cycle. Corpus building (which needs internal/ingest) is deliberately left to the packages that need it, to keep this package cycle-free.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chdir

func Chdir(t *testing.T, dir string)

Chdir switches into dir for the duration of the test, restoring the previous working directory on cleanup.

func DiscardLogger

func DiscardLogger() *slog.Logger

DiscardLogger returns a slog logger that writes nowhere, keeping test output clean while still exercising logging code paths.

func NewDB

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

NewDB opens a fresh migrated SQLite database under a per-test temp directory and registers its close on cleanup. It is the canonical replacement for the per-package "open temp migrated db" helpers.

func WriteFile

func WriteFile(t *testing.T, dir, rel, content string) string

WriteFile writes content to dir/rel, creating parent directories, and returns the absolute path written.

Types

This section is empty.

Jump to

Keyboard shortcuts

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