Categorygithub.com/tisonkun/assert
modulepackage
1.2.1
Repository: https://github.com/tisonkun/assert.git
Documentation: pkg.go.dev

# README

Assert

Description

This package is heavily inspired from stretchr/testify, and you can regard it as a fork of the upstream repository.

This package extracts all assertions and republish them with new ones including:

  • (*Assertion).ErrorRegexp

The Assert package servers as a supplement of Golang's testing for convenient assertions. And thus I don't want to implement anything like suite or mock.

  • suite can be simply implemented leveraging Golang's Subtests.
  • mock is not a good practice as it's hard to sync logics between the mock and the real object.

Usage

go get github.com/tisonkun/assert

Copyright & License

The bundle itself is licensed under the Apache License.

Copyright 2022 tison [email protected].

You can see all transitive licenses and notices under the LICENSES folder.

# Functions

CallerInfo returns an array of strings containing the file and line number of each stack frame leading from the current test to the assert call that failed.
New makes a new Assertions object for the specified TestingT.
ObjectsAreEqual determines if two objects are considered equal.
ObjectsAreEqualValues gets whether two objects are equal, or if their values are equal.

# Structs

Assertions provides assertion methods around the TestingT interface.

# Interfaces

TestingT is an interface wrapper around *testing.T.

# Type aliases

No description provided by the author
Comparison is a custom function that returns true on success and false on failure.
PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics methods, and represents a simple func that takes no arguments, and returns nothing.