Help us shape the future of Go! Take the 2026 Go Developer Survey

testutil

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package testutil holds helpers shared by the core packages' tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SQLiteSchema added in v0.29.0

func SQLiteSchema(tb testing.TB, db *sql.DB, tables ...string) []string

SQLiteSchema returns one normalized line per column and per index of tables, read from SQLite's own catalog instead of the statements that created them. Two databases built by different code paths (a store's boot-time CREATE TABLE and its migration) have the same schema when their lines are equal.

func TempDir

func TempDir(tb testing.TB) string

TempDir is t.TempDir for directories that hold SQLite files: the directory is removed after the test's later cleanups (database Close included) and the removal is retried for a few seconds.

shortcut: on Windows, Defender and the search indexer briefly open files that were just written; deleting such a file only marks it delete-pending, so removing the directory fails with "directory is not empty" for a few milliseconds. It happens with plain os.WriteFile files too (no handle of ours is open), and testing.T.TempDir retries only access-denied errors. Drop this helper when testing retries ERROR_DIR_NOT_EMPTY.

Types

This section is empty.

Jump to

Keyboard shortcuts

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