usure

package module
v0.0.0-...-5aad845 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 3 Imported by: 1

README

Usure

Go Reference Go Report Card License

A tiny and simple testing library

Example Example

Output Output

Install

import "github.com/stelmanjones/termtools/usure"

Features

  • Nil Check: Checks if the provided value is nil.
result := usure.Nil(value)
  • Not Nil Check: Checks if the provided value is not nil.
result := usure.NotNil(value)
  • Instance Check: Checks if the two provided values are of the same type.
result := usure.IsInstance(value1, value2)
  • Equality Check: Checks if the two provided values are equal.
result := usure.Equal(value1, value2)
  • Inequality Check: Checks if the two provided values are not equal.
result := usure.NotEqual(value1, value2)
  • Expect Equality: Logs an error message if the two provided values are not equal.
usure.ExpectEqual("Values should be equal", value1, value2)

Documentation

Overview

Package usure provides a few assertions.

Package usure provides a few assertions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(comparison func() (success bool), msg string) bool

func Equal

func Equal[T any](a, b T) bool

Equal checks if a and b are equal.

func Expect

func Expect[T comparable](value T) *expectedValue[T]

func ExpectEqual

func ExpectEqual[T any](msg string, a, b T) bool

ExpectEqual checks if a and b are equal and prints a message if the condition is false.

func IsInstance

func IsInstance[T any](a T) bool

IsInstance checks if a is an instance of T.

func Nil

func Nil(a any) bool

Nil checks if a is nil.

func NotEqual

func NotEqual[T any](a, b T) bool

NotEqual checks if a and b are not equal.

func NotNil

func NotNil(a any) bool

NotNil checks if a is not nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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