goconveyx

package module
v0.0.0-...-10bc073 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2018 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

GoconveyX

Build Status Coverage Status

GoconveyX extends goconvey by providing a few more functions:

  • ShouldDeepEqual
  • ShouldResembleSlice
  • ShouldResembleByKey

Documentation

GoDoc

ShouldDeepEqual

ShouldDeepEqual is the same as ShouldResemble with better error message.

ShouldResembleSlice

ShouldResembleSlice does deep equal comparison on two slices without ordering.

ShouldResembleSlice([]int{1, 2, 3}, []int{1, 2, 3})    // true
ShouldResembleSlice([]int{1, 2, 3}, []int{3, 1, 2})    // true
ShouldResembleSlice([]int{1, 2, 3}, []int{1, 2, 3, 1}) // false
ShouldResembleByKey

ShouldResembleByKey does deep equal comparison on two slices sorted by given key. It works on slices with map and struct as element. It's useful when you want to compare rows retrieved from database.

type M map[string]interface{}

ShouldResembleByKey("id")(
    []M{{"id": 1, "v": 10}, {"id": 2, "v": 20}},
    []M{{"id": 2, "v": 20}, {"id": 1, "v": 10}},
) // true

ShouldResembleByKey("id")(
    []M{{"id": 1, "v": 10}, {"id": 2, "v": 20}},
    []M{{"id": 2, "v": 10}, {"id": 1, "v": 20}},
) // false

License

Documentation

Overview

Package goconveyx extends github.com/smartystreets/goconvey by providing a few more functions:

  • ShouldDeepEqual
  • ShouldResembleSlice
  • ShouldResembleByKey

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldDeepEqual

func ShouldDeepEqual(actual interface{}, expected ...interface{}) string

ShouldDeepEqual is the same as ShouldResemble with better error message.

func ShouldResembleByKey

func ShouldResembleByKey(key string) func(actual interface{}, expected ...interface{}) string

ShouldResembleByKey does deep equal comparison on two slices sorted by given key. It works on slices with map and struct as element. It's useful when you want to compare rows retrieved from database.

func ShouldResembleSlice

func ShouldResembleSlice(actual interface{}, expected ...interface{}) string

ShouldResembleSlice does deep equal comparison on two slices without ordering.

Types

This section is empty.

Jump to

Keyboard shortcuts

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