package
1.1.3
Repository: https://github.com/go-spring/spring-base.git
Documentation: pkg.go.dev

# README

assert

Provides some useful assertion methods.

Install

go get github.com/go-spring/[email protected] 

Import

import "github.com/go-spring/spring-base/assert"

Example

assert.True(t, ok)
assert.False(t, ok)
assert.Nil(t, nil)
assert.Equal(t, 0, "0")
assert.NotEqual(t, "0", 0)
assert.Same(t, 0, "0")
assert.NotSame(t, "0", "0")
assert.Panic(t, func() {}, "an error")
assert.Matches(t, "there's no error", "an error")
assert.Error(t, errors.New("there's no error"), "an error")
assert.TypeOf(t, new(int), (*int)(nil))
assert.Implements(t, errors.New("error"), (*error)(nil))

# Functions

Equal assertion failed when got and expect are not `deeply equal`.
Error assertion failed when got `error` doesn't match expr expression.
False assertion failed when got is true.
Implements assertion failed when got doesn't implement expect.
JsonEqual assertion failed when got and expect are not `json equal`.
Matches assertion failed when got doesn't match expr expression.
NewMockT creates a new mock instance.
Nil assertion failed when got is not nil.
NotEqual assertion failed when got and expect are `deeply equal`.
NotNil assertion failed when got is nil.
NotSame assertion failed when got and expect are same.
Panic assertion failed when fn doesn't panic or not match expr expression.
Same assertion failed when got and expect are not same.
String returns an assertion for type string.
True assertion failed when got is false.
TypeOf assertion failed when got and expect are not same type.

# Structs

MockT is a mock of T interface.
MockTMockRecorder is the mock recorder for MockT.
StringAssertion assertion for type string.

# Interfaces

T is the minimum interface of *testing.T.