problemtest

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 10 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 problemtest helps tests of notesd's problem records: a fake problem.Recorder, and a datagram socket that stands in for the journal, whose records are decoded and checked with github.com/frostyard/std/problems.

Index

Constants

View Source
const AppID = "org.frostyard.Frostnotes"

AppID is the app ID of every frostnotes record.

Variables

This section is empty.

Functions

func Check

func Check(t testing.TB, fields map[string]string, want Want)

Check compares fields, a record that Next returned, with want: the app ID, the version, the Go runtime, the daemon component, the class and the code.

Types

type Fake

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

Fake is a problem.Recorder that keeps the codes it gets.

func (*Fake) Codes

func (f *Fake) Codes() []string

Codes returns the codes recorded so far, in order.

func (*Fake) Error

func (f *Fake) Error(code string, _ error)

Error implements problem.Recorder.

type Journal

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

Journal is a unixgram socket in a temporary folder that takes records in place of the journal's socket.

func Listen

func Listen(t testing.TB) *Journal

Listen binds a Journal in a short temporary folder (a socket's path holds at most 108 bytes, more than a test's TempDir can leave); it closes, and the folder is removed, when the test ends.

func (*Journal) Next

func (j *Journal) Next(t testing.TB) map[string]string

Next waits for the next record, decodes it, checks it with problems.Validate, and returns its fields.

func (*Journal) None

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

None fails when the socket holds a record. A recorder sends a record before the call that writes it returns, so the socket is read without waiting.

type Want

type Want struct {
	Version string // FROSTYARD_APP_VERSION
	Class   string // panic or error
	Code    string // FROSTYARD_CODE; empty for a panic
}

Want is what a test expects of a record of notesd.

Jump to

Keyboard shortcuts

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