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

Add prefix and suffix assertions #629

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

georgelesica-wf
Copy link

@georgelesica-wf georgelesica-wf commented Jul 9, 2018

I found myself wanting to make assertions about string and slice prefixes and suffixes so I thought these might make sense for others as well.

I modeled the new assertions off of the existing Contains assertion, but I am open to changing it if the maintainers have other preferences.

I also changed the code generation script a bit to try to make it pass reliably across all relevant Go versions. If these issues can be resolved some better way I'd be happy to revert my changes.

@georgelesica-wf
Copy link
Author

georgelesica-wf commented Jul 9, 2018

So I'm not really sure why, but I can't get the generate script to run locally...

$ ./.travis.gogenerate.sh
2018/07/09 15:24:06 assertions.go:19:2: could not import github.com/davecgh/go-spew/spew (can't find import: "github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew")
exit status 1
assert/assertions.go:23: running "go": exit status 1
2018/07/09 15:24:06 assertions.go:19:2: could not import github.com/davecgh/go-spew/spew (can't find import: "github.com/stretchr/testify/vendor/github.com/davecgh/go-spew/spew")
exit status 1
require/forward_requirements.go:16: running "go": exit status 1
$ go version
go version go1.10 darwin/amd64

If I switch to using a source importer (importer.For("source", nil)) then it works on the newer versions, but fails on the older version (since that importer didn't exist). I see the same error on master as I do when running this branch with 1.10, for what it's worth.

@georgelesica-wf
Copy link
Author

@ernesto-jimenez I can't seem to get the code generation to work in all versions of Go, even on master, any thoughts?

@hekonsek
Copy link

+1 for this PR :)

@georgelesica-wf
Copy link
Author

georgelesica-wf commented Jul 12, 2018

It looks like #620 will fix the build.

@systay
Copy link

systay commented Apr 29, 2019

Another +1 for this addition

Copy link
Collaborator

@dolmen dolmen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code must be rebased before review.

Copy link
Collaborator

@dolmen dolmen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many irrelevant changes in this PR: changing the codegen system should be separated from changes adding new features.

@@ -3,6 +3,9 @@
*.a
*.so

# Binaries
codegen

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should not be bundled in this PR.

@@ -1,5 +1,7 @@
#!/bin/bash

echo ".travis.gofmt.sh"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should not be bundled in this PR.

set -e
set -o pipefail

echo ".travis.gogenerate.sh"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should not be bundled in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants