Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically generate assertions.go #650

Merged
merged 1 commit into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 63 additions & 61 deletions convey/assertions.go
Original file line number Diff line number Diff line change
@@ -1,73 +1,75 @@
package convey

// DO NOT EDIT: generated by update_assertions.sh

//go:generate ./update_assertions.sh

import "github.com/smartystreets/assertions"

// These assertions are forwarded from github.com/smartystreets/assertions
// in order to make convey self-contained.
var (
ShouldEqual = assertions.ShouldEqual
ShouldNotEqual = assertions.ShouldNotEqual
ShouldAlmostEqual = assertions.ShouldAlmostEqual
ShouldNotAlmostEqual = assertions.ShouldNotAlmostEqual
ShouldEqualJSON = assertions.ShouldEqualJSON
ShouldResemble = assertions.ShouldResemble
ShouldNotResemble = assertions.ShouldNotResemble
ShouldPointTo = assertions.ShouldPointTo
ShouldNotPointTo = assertions.ShouldNotPointTo
ShouldBeNil = assertions.ShouldBeNil
ShouldNotBeNil = assertions.ShouldNotBeNil
ShouldBeTrue = assertions.ShouldBeTrue
ShouldBeFalse = assertions.ShouldBeFalse
ShouldBeZeroValue = assertions.ShouldBeZeroValue
ShouldNotBeZeroValue = assertions.ShouldNotBeZeroValue

ShouldAlmostEqual = assertions.ShouldAlmostEqual
ShouldBeBetween = assertions.ShouldBeBetween
ShouldBeBetweenOrEqual = assertions.ShouldBeBetweenOrEqual
ShouldBeBlank = assertions.ShouldBeBlank
ShouldBeChronological = assertions.ShouldBeChronological
ShouldBeEmpty = assertions.ShouldBeEmpty
ShouldBeError = assertions.ShouldBeError
ShouldBeFalse = assertions.ShouldBeFalse
ShouldBeGreaterThan = assertions.ShouldBeGreaterThan
ShouldBeGreaterThanOrEqualTo = assertions.ShouldBeGreaterThanOrEqualTo
ShouldBeIn = assertions.ShouldBeIn
ShouldBeLessThan = assertions.ShouldBeLessThan
ShouldBeLessThanOrEqualTo = assertions.ShouldBeLessThanOrEqualTo
ShouldBeBetween = assertions.ShouldBeBetween
ShouldBeNil = assertions.ShouldBeNil
ShouldBeTrue = assertions.ShouldBeTrue
ShouldBeZeroValue = assertions.ShouldBeZeroValue
ShouldContain = assertions.ShouldContain
ShouldContainKey = assertions.ShouldContainKey
ShouldContainSubstring = assertions.ShouldContainSubstring
ShouldEndWith = assertions.ShouldEndWith
ShouldEqual = assertions.ShouldEqual
ShouldEqualJSON = assertions.ShouldEqualJSON
ShouldEqualTrimSpace = assertions.ShouldEqualTrimSpace
ShouldEqualWithout = assertions.ShouldEqualWithout
ShouldHappenAfter = assertions.ShouldHappenAfter
ShouldHappenBefore = assertions.ShouldHappenBefore
ShouldHappenBetween = assertions.ShouldHappenBetween
ShouldHappenOnOrAfter = assertions.ShouldHappenOnOrAfter
ShouldHappenOnOrBefore = assertions.ShouldHappenOnOrBefore
ShouldHappenOnOrBetween = assertions.ShouldHappenOnOrBetween
ShouldHappenWithin = assertions.ShouldHappenWithin
ShouldHaveLength = assertions.ShouldHaveLength
ShouldHaveSameTypeAs = assertions.ShouldHaveSameTypeAs
ShouldImplement = assertions.ShouldImplement
ShouldNotAlmostEqual = assertions.ShouldNotAlmostEqual
ShouldNotBeBetween = assertions.ShouldNotBeBetween
ShouldBeBetweenOrEqual = assertions.ShouldBeBetweenOrEqual
ShouldNotBeBetweenOrEqual = assertions.ShouldNotBeBetweenOrEqual

ShouldContain = assertions.ShouldContain
ShouldNotContain = assertions.ShouldNotContain
ShouldContainKey = assertions.ShouldContainKey
ShouldNotContainKey = assertions.ShouldNotContainKey
ShouldBeIn = assertions.ShouldBeIn
ShouldNotBeIn = assertions.ShouldNotBeIn
ShouldBeEmpty = assertions.ShouldBeEmpty
ShouldNotBeEmpty = assertions.ShouldNotBeEmpty
ShouldHaveLength = assertions.ShouldHaveLength

ShouldStartWith = assertions.ShouldStartWith
ShouldNotStartWith = assertions.ShouldNotStartWith
ShouldEndWith = assertions.ShouldEndWith
ShouldNotEndWith = assertions.ShouldNotEndWith
ShouldBeBlank = assertions.ShouldBeBlank
ShouldNotBeBlank = assertions.ShouldNotBeBlank
ShouldContainSubstring = assertions.ShouldContainSubstring
ShouldNotContainSubstring = assertions.ShouldNotContainSubstring

ShouldPanic = assertions.ShouldPanic
ShouldNotPanic = assertions.ShouldNotPanic
ShouldPanicWith = assertions.ShouldPanicWith
ShouldNotPanicWith = assertions.ShouldNotPanicWith

ShouldHaveSameTypeAs = assertions.ShouldHaveSameTypeAs
ShouldNotHaveSameTypeAs = assertions.ShouldNotHaveSameTypeAs
ShouldImplement = assertions.ShouldImplement
ShouldNotImplement = assertions.ShouldNotImplement

ShouldHappenBefore = assertions.ShouldHappenBefore
ShouldHappenOnOrBefore = assertions.ShouldHappenOnOrBefore
ShouldHappenAfter = assertions.ShouldHappenAfter
ShouldHappenOnOrAfter = assertions.ShouldHappenOnOrAfter
ShouldHappenBetween = assertions.ShouldHappenBetween
ShouldHappenOnOrBetween = assertions.ShouldHappenOnOrBetween
ShouldNotHappenOnOrBetween = assertions.ShouldNotHappenOnOrBetween
ShouldHappenWithin = assertions.ShouldHappenWithin
ShouldNotHappenWithin = assertions.ShouldNotHappenWithin
ShouldBeChronological = assertions.ShouldBeChronological

ShouldBeError = assertions.ShouldBeError
ShouldWrap = assertions.ShouldWrap
ShouldNotBeBlank = assertions.ShouldNotBeBlank
ShouldNotBeChronological = assertions.ShouldNotBeChronological
ShouldNotBeEmpty = assertions.ShouldNotBeEmpty
ShouldNotBeIn = assertions.ShouldNotBeIn
ShouldNotBeNil = assertions.ShouldNotBeNil
ShouldNotBeZeroValue = assertions.ShouldNotBeZeroValue
ShouldNotContain = assertions.ShouldNotContain
ShouldNotContainKey = assertions.ShouldNotContainKey
ShouldNotContainSubstring = assertions.ShouldNotContainSubstring
ShouldNotEndWith = assertions.ShouldNotEndWith
ShouldNotEqual = assertions.ShouldNotEqual
ShouldNotHappenOnOrBetween = assertions.ShouldNotHappenOnOrBetween
ShouldNotHappenWithin = assertions.ShouldNotHappenWithin
ShouldNotHaveSameTypeAs = assertions.ShouldNotHaveSameTypeAs
ShouldNotImplement = assertions.ShouldNotImplement
ShouldNotPanic = assertions.ShouldNotPanic
ShouldNotPanicWith = assertions.ShouldNotPanicWith
ShouldNotPointTo = assertions.ShouldNotPointTo
ShouldNotResemble = assertions.ShouldNotResemble
ShouldNotStartWith = assertions.ShouldNotStartWith
ShouldPanic = assertions.ShouldPanic
ShouldPanicWith = assertions.ShouldPanicWith
ShouldPointTo = assertions.ShouldPointTo
ShouldResemble = assertions.ShouldResemble
ShouldStartWith = assertions.ShouldStartWith
ShouldWrap = assertions.ShouldWrap
)
31 changes: 31 additions & 0 deletions convey/update_assertions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

cd "$(dirname $(realpath $0))"

ASSERTIONS=($(
go tool nm "$(go list -export -f '{{.Export}}' github.com/smartystreets/assertions)" |\
awk '/ T github\.com\/smartystreets\/assertions\.Should/{split($3, a, "."); print a[3]}' |\
sort | uniq))

(
echo "package convey"
echo
echo "// DO NOT EDIT: generated by update_assertions.sh"
echo
echo "//go:generate ./update_assertions.sh"
echo
echo "import \"github.com/smartystreets/assertions\""
echo
echo "// These assertions are forwarded from github.com/smartystreets/assertions"
echo "// in order to make convey self-contained."
echo "var ("

for assertion in "${ASSERTIONS[@]}"
do
echo " $assertion = assertions.$assertion"
done

echo ")"
) > ./assertions.go

go fmt ./assertions.go