problemstest

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 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 problemstest is a journal socket for tests of problem records (ADR-0049): a unixgram socket in a temporary folder that a recorder made with problems.WithSocket writes to, and the checks of what it received.

Index

Constants

View Source
const AppID = config.AppID

AppID is the app ID of every Frostmail record.

View Source
const Version = "1.2.3"

Version is the release version the tests' recorders write.

Variables

This section is empty.

Functions

This section is empty.

Types

type Journal

type Journal struct {
	// Path is the socket's path, for problems.WithSocket.
	Path string
	// contains filtered or unexported fields
}

Journal is a test journal socket.

func Listen

func Listen(t testing.TB) *Journal

Listen binds a journal socket in a new temporary folder, which the test's end removes. The folder is short: a socket path has at most 107 bytes.

func (*Journal) Next

func (j *Journal) Next(t testing.TB) Record

Next reads the next record, decodes it and validates it, or fails the test.

func (*Journal) NextError

func (j *Journal) NextError(t testing.TB, component problems.Component, code string) Record

NextError reads the next record and checks that it is the error code of component, from a recorder made by j.Recorder.

func (*Journal) NextPanic

func (j *Journal) NextPanic(t testing.TB, component problems.Component) Record

NextPanic reads the next record and checks that it is a panic of component, from a recorder made by j.Recorder or with the same identity.

func (*Journal) None

func (j *Journal) None(t testing.TB)

None fails the test when a record is waiting in the socket. Records are sent before the recording call returns, so a check right after the code under test sees every record it wrote.

func (*Journal) Recorder

func (j *Journal) Recorder(t testing.TB, component problems.Component) *problems.Recorder

Recorder is a recorder of component at Version that writes to j.

type Record

type Record struct {
	Fields map[string]string
	problems.Detail
}

Record is 1 received record that passed problems.Validate.

func (Record) Message

func (r Record) Message() string

Message is the record's MESSAGE.

Jump to

Keyboard shortcuts

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