Test harness can now assert if errors have been raised correctly #402
Conversation
There was a problem hiding this 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") |
There was a problem hiding this comment.
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()
.
test/integration_testcase.go
Outdated
|
||
if wantExists && gotExists { | ||
if !strings.Contains(got, want) { | ||
tc.t.Errorf("expected error %s, got error %s", want, got) |
There was a problem hiding this comment.
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"
@sdboyer small change done 馃憤 |
@domgreen excellent! thanks so much for your perseverance! |
@domgreen also, you should fix your email so your user gets properly associated with these commits 馃槃 |
@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. |
Looks like you got it 馃槂 |
Test harness can now assert if errors have been raised correctly
@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 馃槃