Documentation ¶
Index ¶
- Constants
- func ArrayElements(inter *interpreter.Interpreter, array *interpreter.ArrayValue) []interpreter.Value
- func AssertEqualWithDiff(t *testing.T, expected, actual any)
- func AssertValueSlicesEqual(t testing.TB, inter *interpreter.Interpreter, ...) bool
- func AssertValuesEqual(t testing.TB, interpreter *interpreter.Interpreter, ...) bool
- func DeploymentTransaction(name string, contract []byte) []byte
- func DictionaryKeyValues(inter *interpreter.Interpreter, dict *interpreter.DictionaryValue) []interpreter.Value
- func RemovalTransaction(name string) []byte
- func RequireError(t *testing.T, err error)
- func RequireValuesEqual(t testing.TB, inter *interpreter.Interpreter, ...)
- func UpdateTransaction(name string, contract []byte) []byte
- func ValuesAreEqual(inter *interpreter.Interpreter, expected, actual interpreter.Value) bool
- type DictionaryEntry
- type OccurrenceMatcher
Constants ¶
const ImportedLocation = common.StringLocation("imported")
ImportedLocation is used as the default location for imported programs in tests.
const TestLocation = common.StringLocation("test")
TestLocation is used as the default location for programs in tests.
Variables ¶
This section is empty.
Functions ¶
func ArrayElements ¶ added in v1.0.0
func ArrayElements(inter *interpreter.Interpreter, array *interpreter.ArrayValue) []interpreter.Value
func AssertEqualWithDiff ¶
AssertEqualWithDiff asserts that two objects are equal.
If the objects are not equal, this function prints a human-readable diff.
func AssertValueSlicesEqual ¶ added in v0.20.0
func AssertValueSlicesEqual(t testing.TB, inter *interpreter.Interpreter, expected, actual []interpreter.Value) bool
func AssertValuesEqual ¶ added in v0.20.0
func AssertValuesEqual(t testing.TB, interpreter *interpreter.Interpreter, expected, actual interpreter.Value) bool
func DeploymentTransaction ¶ added in v0.5.0
func DictionaryKeyValues ¶ added in v1.0.0
func DictionaryKeyValues(inter *interpreter.Interpreter, dict *interpreter.DictionaryValue) []interpreter.Value
func RemovalTransaction ¶ added in v0.10.5
func RequireError ¶ added in v0.28.0
RequireError is a wrapper around require.Error which also ensures that the error message, the secondary message (if any), and the error notes' (if any) messages can be successfully produced
func RequireValuesEqual ¶ added in v0.20.0
func RequireValuesEqual(t testing.TB, inter *interpreter.Interpreter, expected, actual interpreter.Value)
func UpdateTransaction ¶ added in v0.10.1
func ValuesAreEqual ¶ added in v0.20.0
func ValuesAreEqual(inter *interpreter.Interpreter, expected, actual interpreter.Value) bool
Types ¶
type DictionaryEntry ¶ added in v1.0.0
type DictionaryEntry[K, V any] struct { Key K Value V }
func DictionaryEntries ¶ added in v1.0.0
func DictionaryEntries[K, V any]( inter *interpreter.Interpreter, dict *interpreter.DictionaryValue, fromKey func(interpreter.Value) (K, bool), fromVal func(interpreter.Value) (V, bool), ) ([]DictionaryEntry[K, V], bool)
DictionaryEntries is similar to DictionaryKeyValues, attempting to map untyped Values to concrete values using the provided morphisms. If a conversion fails, then this function returns (nil, false). Useful in contexts when Cadence values need to be extracted into their go counterparts.