fi

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package fi provides shorthands for testify patterns - "fi is short for testify"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupF added in v0.2.0

func CleanupF(t *testing.T, f func() error)

func NoErrorF

func NoErrorF(f func() error, t assert.TestingT)

NoErrorF fails the current test if f returns an error. Useful in defer.

func SkipLongTest

func SkipLongTest(t *testing.T)

SkipLongTest skips the current test when -short is set

Types

type Requirement

type Requirement[T any] struct {
	// The value returned by Require if the check passes
	Val   T
	Check func(t require.TestingT)
}

Requirement associates checks with a value

func FileExists added in v0.2.1

func FileExists(path string) Requirement[string]

FileExists defines a requirement that the file exists (experimental)

func NoError

func NoError[T any](val T, err error) Requirement[T]

NoError defines a requirement that the result of the function can be used, and the associated error is nil

func (Requirement[T]) Require

func (r Requirement[T]) Require(t require.TestingT) T

Require returns the Requirement value if the Check doesn't fail the current test

Jump to

Keyboard shortcuts

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