Skip to content

Commit

Permalink
Check properly if an error is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
ldmberman committed Sep 21, 2015
1 parent f0f6444 commit 5e3bcc4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions model_loader/model_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,12 @@ func TestModelLoader(t *testing.T) {
t.Logf("Executing %d test case.", i+1)
res := testModel{}
err := model_loader.LoadModel(testCase.args, &res)
if (err != nil || testCase.err != "") && err.Error() != testCase.err {
t.Errorf("Invalid error.\n Expected: %s,\n obtained %s", testCase.err, err.Error())
errMsg := ""
if err != nil {
errMsg = err.Error()
}
if (err != nil || testCase.err != "") && errMsg != testCase.err {
t.Errorf("Invalid error.\n Expected: %s,\n obtained %s", testCase.err, errMsg)
}
if testCase.res != nil && !reflect.DeepEqual(testCase.res, res) {
t.Errorf("Invalid result.\n expected %#v,\n obtained %#v", testCase.res, res)
Expand Down

0 comments on commit 5e3bcc4

Please sign in to comment.