Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Test harness can now assert if errors have been raised correctly #402

Merged
merged 5 commits into from Apr 29, 2017

Conversation

domgreen
Copy link
Contributor

@sdboyer new PR for updating the test harness to have verify errors, with the other update work that has happened the error that I was having earlier has now gone 馃槃

@domgreen domgreen mentioned this pull request Apr 19, 2017
Copy link
Member

@sdboyer sdboyer left a comment

Choose a reason for hiding this comment

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

Sorry, this fell off my radar again :/

Just a small change, then I promise, merge time 馃槃

cmd/dep/init.go Outdated
@@ -73,7 +73,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
return err
}
if mok {
return errors.Errorf("manifest file %q already exists", mf)
return errors.New("manifest file already exists")
Copy link
Member

Choose a reason for hiding this comment

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

This isn't the best - we don't want to remove useful information from an error message that's shown to humans just to make the tests pass.

Let's change it to return errors.Errorf("manifest already exists: %s", mf), then change the check from exact equality to strings.Contains().


if wantExists && gotExists {
if !strings.Contains(got, want) {
tc.t.Errorf("expected error %s, got error %s", want, got)
Copy link
Member

Choose a reason for hiding this comment

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

Text here will need to change slightly to match the notion of "contains" instead of "equals"

@domgreen
Copy link
Contributor Author

@sdboyer small change done 馃憤

@sdboyer
Copy link
Member

sdboyer commented Apr 29, 2017

@domgreen excellent! thanks so much for your perseverance!

@sdboyer sdboyer merged commit c29d650 into golang:master Apr 29, 2017
@sdboyer
Copy link
Member

sdboyer commented Apr 29, 2017

@domgreen also, you should fix your email so your user gets properly associated with these commits 馃槃

@domgreen
Copy link
Contributor Author

@sdboyer oh I thought I had done that 馃樋 take it its something I need to do on my local machine as well as my GitHub profile.

@sdboyer
Copy link
Member

sdboyer commented Apr 29, 2017

Looks like you got it 馃槂

ibrasho pushed a commit to ibrasho-forks/dep that referenced this pull request May 10, 2017
Test harness can now assert if errors have been raised correctly
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants