assert

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: BSD-2-Clause Imports: 3 Imported by: 12

README

assert

Simple library for run-time assertions in Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(cond bool, text string)

Assert panics with Error if cond is false.

func AssertNotNil

func AssertNotNil(v interface{})

AssertNotNil is a compatibility alias for NotNil.

func Assertf

func Assertf(cond bool, format string, v ...interface{})

Assertf panics with Error if cond is false.

func NotNil added in v1.1.0

func NotNil(v interface{})

NotNil takes a pointer to a nil-able type (pointer, interface, etc) and panics with Error if the pointed-to value is nil.

func Raise added in v1.2.0

func Raise(text string)

Raise panics with Error.

func Raisef added in v1.2.0

func Raisef(format string, v ...interface{})

Raisef panics with Error.

Types

type AssertionError

type AssertionError = Error

AssertionError is a compatibility alias for Error.

type Error added in v1.1.0

type Error struct {
	Text string
}

Error is the error type for Assert failure panics.

func (Error) Error added in v1.1.0

func (err Error) Error() string

Error fulfills the error interface.

Jump to

Keyboard shortcuts

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