package
Version:
v0.2.1
Opens a new window with list of versions in this module.
Published: Mar 24, 2025
License: Apache-2.0
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package assert provides utility functions for testing
which help assert certain conditions are met.
-
func Equal(t *testing.T, expected, actual interface{}) bool
-
func Error(t *testing.T, err error) bool
-
func False(t *testing.T, actual bool) bool
-
func Len(t *testing.T, v interface{}, length int) bool
-
func NoError(t *testing.T, err error) bool
-
func NotEmpty(t *testing.T, v any) bool
-
func Require(t *testing.T, isPassing bool)
-
func True(t *testing.T, actual bool) bool
Equal fails the test if the expected and actual values are not equal.
Error fails the test if the error is nil.
False fails the test if the actual value is not false.
Len fails the test if the value is not of the expected length.
NoError fails the test if the error is not nil.
NotEmpty fails the test if the value is empty.
Require fails the test if the provided boolean is false.
It should be used in conjunction with assert functions.
Example:
assert.Require(t, assert.AssertError(t, err))
True fails the test if the actual value is not true.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.