assert

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 5 Imported by: 15

Documentation

Overview

Package assert allows callers to configure test oracles for the Antithesis testing platform.

For full functionality, code should be indexed by the antithesis-go-generator command so that Antithesis can know what invocations to expect. This is needed for Always, Sometime, and Reachable. It will make reporting about Unreachable and AlwaysOrUnreachable more understandable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Always added in v0.1.15

func Always(message string, condition bool, values map[string]any)

Assert that condition is true one or more times during a test. Callers of `Always` can see failures in two cases: 1. If this function is ever invoked with a `false` for the conditional or 2. If an "indexed" invocation of Always is not covered at least once. message will be used as a display name in reporting and should therefore be useful to a broad audience. The map of values is used to supply context useful for understanding the reason that condition had the value it did. For instance, in an asertion that x > 5, it could be helpful to send the value of x so failing cases can be better understood.

func AlwaysOrUnreachable added in v0.1.15

func AlwaysOrUnreachable(message string, condition bool, values map[string]any)

Assert that condition is true if it is ever evaluated. Callers will not see a failure in their test if the condition is never evaluated. message will be used as a display name in reporting and should therefore be useful to a broad audience. The map of values is used to supply context useful for understanding the reason that condition had the value it did. For instance, in an asertion that x > 5, it could be helpful to send the value of x so failing cases can be better understood.

func AssertRaw added in v0.1.18

func AssertRaw(message string, cond bool, values map[string]any, classname, funcname, filename string, line int, hit bool, must_hit bool, expecting bool, assert_type string)

Unwrapped raw assertion access for custom tooling. Not to be called directly.

func Reachable added in v0.1.10

func Reachable(message string, values map[string]any)

Assert that some path of code is tested. If any call to Reachable is not invoked during the course of a test a failure will be noted. message will be used as a display name in reporting and should therefore be useful to a broad audience. The map of values is used to supply context useful for understanding the reason that this code path was taken.

func Sometimes added in v0.1.15

func Sometimes(message string, condition bool, values map[string]any)

Assert that condition is true at least once in a test. Callers that invoke Sometimes will only see an error if that particualr invocation is neven called with condtition true. message will be used as a display name in reporting and should therefore be useful to a broad audience. The map of values is used to supply context useful for understanding the reason that condition had the value it did. For instance, in an asertion that x > 5, it could be helpful to send the value of x so failing cases can be better understood.

func Unreachable added in v0.1.10

func Unreachable(message string, values map[string]any)

Assert that some path of code is not taken. A failure will be raised if this function is ever called. message will be used as a display name in reporting and should therefore be useful to a broad audience. The map of values is used to supply context useful for understanding the reason that this code path was taken.

Types

This section is empty.

Jump to

Keyboard shortcuts

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