has

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2018 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllKeys

func AllKeys(expected ...interface{}) *gocrest.Matcher

AllKeys is a matcher that checks if map actual has all keys == expecteds. Panics when actual's Kind is not a map. Returns a matcher that matches when a map has all keys == all expected.

func FieldNamed

func FieldNamed(expected string) *gocrest.Matcher

FieldNamed is a naive implementation for testing if a struct has a particular field name. Does not check type. Returns a matcher that will use reflect to check if the actual has the method given by expected

func FunctionNamed

func FunctionNamed(expected string) *gocrest.Matcher

FunctionNamed implementation for testing if a Type has a particular method name. Does not check parameters. Returns a matcher that will use reflect to check if the actual has the method given by expected.

func Key

func Key(expected interface{}) *gocrest.Matcher

Key is a matcher that checks if actual has a key == expected. Panics when actual's Kind is not a map. Returns a matcher that matches when a map has key == expected

func Length

func Length(expected interface{}) *gocrest.Matcher

Length can be called with arrays, maps, *gocrest.Matcher and strings but not numeric types. has.Length(is.GreaterThan(x)) is a valid call. Returns a matcher that matches if the length matches the given criteria

func Prefix

func Prefix(expected string) *gocrest.Matcher

Prefix returns a matcher that matches if the given string is prefixed with the expected string Function panics if the actual is not a string. Uses strings.Prefix(act, exp) to evaluate strings. Returns a matcher that returns true if the above conditions are met

func Suffix

func Suffix(expected string) *gocrest.Matcher

Suffix returns a matcher that matches if the given string is suffixed with the expected string. Panics if the actual is not a string. Uses strings.Suffix(act,exp) to evaluate strings. Returns a matcher that returns true if the above conditions are met.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL