mustr

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package mustr is guaranteed to only export symbols starting with word Must or R. It is intended to be used in tests via dot-import:

import (
    "testing"

    . "import.name/testing/mustr"
)

func example() (int, error)

func Test(t *testing.T) {
    _ = Must(t, R(example()))
}

Test fails immediately if example returns an error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must

func Must[Value any](t internal.Testing, r internal.Result[Value]) Value

Must calls t.Fatal() with the error (the second value of the result) if it is non-nil, otherwise it returns the first value of the result.

func R

func R[Value any](x Value, err error) internal.Result[Value]

R can be used to wrap the result of a function call which returns two values, the second of which is an error.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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