Documentation
¶
Index ¶
- Constants
- func AssertImpl(text string, cond bool, values any, loc *LocationInfo, hit bool, must_hit bool, ...)
- func Can_emit() bool
- func FalseIfReached(text string, cond bool, values any, options ...string)
- func IsFalse(text string, cond bool, values any, options ...string)
- func IsTrue(text string, cond bool, values any, options ...string)
- func No_emit() bool
- func Reachable(text string, values any, options ...string)
- func SometimesFalse(text string, cond bool, values any, options ...string)
- func SometimesTrue(text string, cond bool, values any, options ...string)
- func TrueIfReached(text string, cond bool, values any, options ...string)
- func Unreachable(text string, values any, options ...string)
- func Version() string
- type AssertInfo
- type LocationInfo
- type StackFrameOffset
Constants ¶
const ColumnUnknown = 0
ColumnUnknown is used when the column associated with a LocationInfo is not available
Variables ¶
This section is empty.
Functions ¶
func AssertImpl ¶
func Can_emit ¶ added in v0.1.12
func Can_emit() bool
Can_emit returns true if assertions will be processed, and returns false if assertions will be ignored
func FalseIfReached ¶ added in v0.1.10
FalseIfReached asserts that when this is evaluated the condition will always be false, or that this is never evaluated.
func IsFalse ¶ added in v0.1.10
IsFalse asserts that when this is evaluated the condition will always be false, and that this is evaluated at least once.
func IsTrue ¶ added in v0.1.10
IsTrue asserts that when this is evaluated the condition will always be true, and that this is evaluated at least once.
func No_emit ¶ added in v0.1.12
func No_emit() bool
Can_emit returns true if assertions will be processed, and returns false if assertions will be ignored
func Reachable ¶ added in v0.1.10
Reachable asserts that this is evaluated at least once. This assertion will fail if it is not evaluated, and otherwise will pass.
func SometimesFalse ¶ added in v0.1.10
SometimesFalse asserts that when this is evaluated the condition will sometimes be false, and that this is evaluated at least once.
func SometimesTrue ¶
SometimesTrue asserts that when this is evaluated the condition will sometimes be true, and that this is evaluated at least once.
func TrueIfReached ¶ added in v0.1.10
TrueIfReached asserts that when this is evaluated the condition will always be true, or that this is never evaluated.
func Unreachable ¶ added in v0.1.10
Unreachable asserts that this is never evaluated. This assertion will fail if it is evaluated.
Types ¶
type AssertInfo ¶
type AssertInfo struct { Hit bool `json:"hit"` MustHit bool `json:"must_hit"` AssertType string `json:"assert_type"` Expecting bool `json:"expecting"` Category string `json:"category"` Message string `json:"message"` Condition bool `json:"condition"` Id string `json:"id"` Location *LocationInfo `json:"location"` Details map[string]any `json:"details"` }
type LocationInfo ¶
type LocationInfo struct { Classname string `json:"classname"` Funcname string `json:"function"` Filename string `json:"filename"` Line int `json:"line"` Column int `json:"column"` }
LocationInfo represents the attributes known at instrumentation time for each Antithesis assertion discovered
func NewLocInfo ¶
func NewLocInfo(classname, funcname, filename string, line int) *LocationInfo
NewLocInfo creates a LocationInfo from values known outside of the current execution context
func NewLocationInfo ¶
func NewLocationInfo(nframes StackFrameOffset) *LocationInfo
NewLocationInfo creates a LocationInfo directly from the current execution context
type StackFrameOffset ¶
type StackFrameOffset int
StackFrameOffset indicates how many frames to go up in the call stack to find the filename/location/line info. As this work is always done in NewLocationInfo(), the offset is specified from the perspective of NewLocationInfo
const ( OffsetNewLocationInfo StackFrameOffset = iota OffsetHere OffsetAPICaller OffsetAPICallersCaller )
Order is important here since iota is being used