Documentation ¶
Index ¶
- Constants
- func AlwaysTrue(text string, cond bool, values any, options ...string)
- func AlwaysTrueIfOccurs(text string, cond bool, values any, options ...string)
- func AssertImpl(text string, cond bool, values any, loc *LocationInfo, hit bool, must_hit bool, ...)
- func NeverOccurs(text string, values any, options ...string)
- func SometimesOccurs(text string, values any, options ...string)
- func SometimesTrue(text string, cond bool, 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 AlwaysTrue ¶
AlwaysTrue asserts that when this is evaluated the condition will always be true, and that this is evaluated at least once. Could be named name is Always()
func AlwaysTrueIfOccurs ¶
AlwaysTrueIfOccurs asserts that when this is evaluated the condition will always be true, or that this is never evaluated. Could be named is UnreachableOrAlways()
func AssertImpl ¶
func NeverOccurs ¶
NeverOccurs asserts that this is never evaluated. This assertion will fail if it is evaluated. Could be named is Unreachable()
func SometimesOccurs ¶
SometimesOccurs asserts that this is evaluated at least once. This assertion will fail if it is not evaluated, and otherwise will pass. Could be named 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. Could be named 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 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