Documentation ¶
Overview ¶
Package subset implements functions to check if one value is a subset of another.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
func Assert(source, target interface{}) error
Assert checks whether target is a subset of source. source and target must be the same type. target is a subset of source when:
- If target and source are slices or arrays, then target must have the same number of elements as source. Each element in target must be a subset of the corresponding element from source.
- If target and source are maps, each key in source must exist in target. The value for each element in target must be a subset of the corresponding element from source.
* Otherwise, target and source must be deeply equal.
An instance of Error will be returned when target is not a subset of source.
Subset checking is primarily useful when doing things like YAML assertions, where you only want to ensure that a subset of YAML is defined as expected.
func YAMLAssert ¶
YAMLAssert is like Assert but accepts YAML bytes as input.
Types ¶
Click to show internal directories.
Click to hide internal directories.