Documentation
¶
Index ¶
- Constants
- func AlwaysTrue(text string, cond bool, values any)
- func AlwaysTrueIfOccurs(text string, cond bool, values any)
- func AssertImpl(text string, cond bool, values any, loc *LocationInfo, hit bool, must_hit bool, ...)
- func NeverOccurs(values any)
- func SometimesOccurs(values any)
- func SometimesTrue(text string, cond bool, values any)
- func Version() string
- type AssertInfo
- type EmitTracker
- type LocalLogAssertInfo
- type LocationInfo
- type StackFrameOffset
- type TrackerInfo
- type WrappedAssertInfo
Constants ¶
const ColumnUnknown = 0
ColumnUnknown is used when the column associated with a LocationInfo is not available
Variables ¶
This section is empty.
Functions ¶
func AlwaysTrue ¶
AlwaysTrue asserts that when this is evaluated the condition will always be true, and that this is evaluated at least once. Alternative name is Always()
func AlwaysTrueIfOccurs ¶
AlwaysTrueIfOccurs asserts that when this is evaluated the condition will always be true, or that this is never evaluated. Alternative name is UnreachableOrAlways()
func AssertImpl ¶
func NeverOccurs ¶
func NeverOccurs(values any)
NeverOccurs asserts that this is never evaluated. This assertion will fail if it is evaluated. Alternative name is Unreachable()
func SometimesOccurs ¶
func SometimesOccurs(values any)
SometimesOccurs asserts that this is evaluated at least once. This assertion will fail if it is not evaluated, and otherwise will pass. Alternative name is Reachable()
func SometimesTrue ¶
SometimesTrue asserts that when this is evaluated the condition will sometimes be true, and that this is evaluated at least once. Alternative name is Sometimes()
Types ¶
type AssertInfo ¶
type AssertInfo struct { Hit bool `json:"hit"` MustHit bool `json:"must_hit"` ExpectType string `json:"expect_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 EmitTracker ¶
type EmitTracker map[string]*TrackerInfo
type LocalLogAssertInfo ¶
type LocalLogAssertInfo struct { local.LocalLogInfo WrappedAssertInfo }
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
type TrackerInfo ¶
-------------------------------------------------------------------------------- EmitTracker --------------------------------------------------------------------------------
func NewTrackerInfo ¶
func NewTrackerInfo() *TrackerInfo
type WrappedAssertInfo ¶
type WrappedAssertInfo struct {
A *AssertInfo `json:"ant_assert"`
}