Documentation ¶
Index ¶
- func Capture_IsMatcher(x interface{}) *bool
- func Matcher_IsMatcher(x interface{}) *bool
- func NewCapture_Override(c Capture, pattern interface{})
- func NewMatchResult_Override(m MatchResult, target interface{})
- func NewMatch_Override(m Match)
- func NewMatcher_Override(m Matcher)
- type Capture
- type Match
- type MatchCapture
- type MatchFailure
- type MatchResult
- type Matcher
- func Match_Absent() Matcher
- func Match_AnyValue() Matcher
- func Match_ArrayEquals(pattern *[]interface{}) Matcher
- func Match_ArrayWith(pattern *[]interface{}) Matcher
- func Match_Exact(pattern interface{}) Matcher
- func Match_Not(pattern interface{}) Matcher
- func Match_ObjectEquals(pattern *map[string]interface{}) Matcher
- func Match_ObjectLike(pattern *map[string]interface{}) Matcher
- func Match_SerializedJson(pattern interface{}) Matcher
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capture_IsMatcher ¶
func Capture_IsMatcher(x interface{}) *bool
Check whether the provided object is a subtype of the `IMatcher`.
func Matcher_IsMatcher ¶
func Matcher_IsMatcher(x interface{}) *bool
Check whether the provided object is a subtype of the `IMatcher`.
func NewCapture_Override ¶
func NewCapture_Override(c Capture, pattern interface{})
Initialize a new capture.
func NewMatchResult_Override ¶
func NewMatchResult_Override(m MatchResult, target interface{})
func NewMatch_Override ¶
func NewMatch_Override(m Match)
func NewMatcher_Override ¶
func NewMatcher_Override(m Matcher)
Types ¶
type Capture ¶
type Capture interface { Matcher Name() *string AsArray() *[]interface{} AsBoolean() *bool AsNumber() *float64 AsObject() *map[string]interface{} AsString() *string Next() *bool Test(actual interface{}) MatchResult }
Capture values while matching templates.
Using an instance of this class within a Matcher will capture the matching value. The `as*()` APIs on the instance can be used to get the captured value.
TODO: EXAMPLE
type MatchCapture ¶ added in v2.1.0
type MatchCapture struct { // The instance of Capture class to which this capture is associated with. Capture Capture `json:"capture" yaml:"capture"` // The value that was captured. Value interface{} `json:"value" yaml:"value"` }
Information about a value captured during match.
TODO: EXAMPLE
type MatchFailure ¶ added in v2.1.0
type MatchFailure struct { // The matcher that had the failure. Matcher Matcher `json:"matcher" yaml:"matcher"` // Failure message. Message *string `json:"message" yaml:"message"` // The relative path in the target where the failure occurred. // // If the failure occurred at root of the match tree, set the path to an empty list. // If it occurs in the 5th index of an array nested within the 'foo' key of an object, // set the path as `['/foo', '[5]']`. Path *[]*string `json:"path" yaml:"path"` }
Match failure details.
TODO: EXAMPLE
type MatchResult ¶
type MatchResult interface { FailCount() *float64 Target() interface{} Compose(id *string, inner MatchResult) MatchResult Finished() MatchResult HasFailed() *bool Push(matcher Matcher, path *[]*string, message *string) MatchResult RecordCapture(options *MatchCapture) RecordFailure(failure *MatchFailure) MatchResult ToHumanStrings() *[]*string }
The result of `Match.test()`.
TODO: EXAMPLE
func NewMatchResult ¶
func NewMatchResult(target interface{}) MatchResult
type Matcher ¶
type Matcher interface { Name() *string Test(actual interface{}) MatchResult }
Represents a matcher that can perform special data matching capabilities between a given pattern and a target.
TODO: EXAMPLE
func Match_Absent ¶
func Match_Absent() Matcher
Use this matcher in the place of a field's value, if the field must not be present.
func Match_ArrayEquals ¶
func Match_ArrayEquals(pattern *[]interface{}) Matcher
Matches the specified pattern with the array found in the same relative path of the target.
The set of elements (or matchers) must match exactly and in order.
func Match_ArrayWith ¶
func Match_ArrayWith(pattern *[]interface{}) Matcher
Matches the specified pattern with the array found in the same relative path of the target.
The set of elements (or matchers) must be in the same order as would be found.
func Match_Exact ¶
func Match_Exact(pattern interface{}) Matcher
Deep exact matching of the specified pattern to the target.
func Match_Not ¶
func Match_Not(pattern interface{}) Matcher
Matches any target which does NOT follow the specified pattern.
func Match_ObjectEquals ¶
Matches the specified pattern to an object found in the same relative path of the target.
The keys and their values (or matchers) must match exactly with the target.
func Match_ObjectLike ¶
Matches the specified pattern to an object found in the same relative path of the target.
The keys and their values (or matchers) must be present in the target but the target can be a superset.
func Match_SerializedJson ¶
func Match_SerializedJson(pattern interface{}) Matcher
Matches any string-encoded JSON and applies the specified pattern after parsing it.
type Template ¶
type Template interface { FindMappings(logicalId *string, props interface{}) *map[string]*map[string]interface{} FindOutputs(logicalId *string, props interface{}) *map[string]*map[string]interface{} FindResources(type_ *string, props interface{}) *map[string]*map[string]interface{} HasMapping(logicalId *string, props interface{}) HasOutput(logicalId *string, props interface{}) HasResource(type_ *string, props interface{}) HasResourceProperties(type_ *string, props interface{}) ResourceCountIs(type_ *string, count *float64) TemplateMatches(expected interface{}) ToJSON() *map[string]interface{} }
Suite of assertions that can be run on a CDK stack.
Typically used, as part of unit tests, to validate that the rendered CloudFormation template has expected resources and properties.
TODO: EXAMPLE
func Template_FromJSON ¶
Base your assertions from an existing CloudFormation template formatted as an in-memory JSON object.
func Template_FromStack ¶
func Template_FromStack(stack awscdk.Stack) Template
Base your assertions on the CloudFormation template synthesized by a CDK `Stack`.
func Template_FromString ¶
Base your assertions from an existing CloudFormation template formatted as a JSON string.