Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Use Testify package for test assertions #71

Merged
merged 4 commits into from
Dec 14, 2014
Merged

Use Testify package for test assertions #71

merged 4 commits into from
Dec 14, 2014

Conversation

pengwynn
Copy link
Collaborator

Prompted by @jingweno's comment, I whipped up a PR to swap out the bmizerany/assert testing package for stretchr/testify. I like testify because:

  • It is actively maintained.
  • It has a number of additional assertions.
  • It can provide a custom failure message without changing assertion method (no more assert.Tf).
  • It has better formatting of failure messages.

Before:

❯ go test ./...
?       github.com/octokit/go-octokit/examples  [no test files]
--- FAIL: TestClientRel (0.00 seconds)
        assert.go:15: /Users/wynn/go/src/github.com/octokit/go-octokit/octokit/root_test.go:37
        assert.go:24: ! 1 != nil

FAIL
FAIL    github.com/octokit/go-octokit/octokit   0.049s

After:

❯ go test ./...
?       github.com/octokit/go-octokit/examples  [no test files]
--- FAIL: TestClientRel (0.00 seconds)
        Location:       root_test.go:37
        Error:          Not equal: 1 (expected)
                                != <nil> (actual)


FAIL
FAIL    github.com/octokit/go-octokit/octokit   0.048s

I made a pass over the tests and made some updates where one of the new assertions made the tests easier to grok.

This change swaps out the assert testing library for testify because:

- It's actively maintained.
- Has a number of additional assertion helpers.
- Can over provide custom failure message without changing assertion
  method.
- Better formatting of failure messages.
@owenthereal
Copy link
Contributor

:shipit:

pengwynn added a commit that referenced this pull request Dec 14, 2014
Use Testify package for test assertions
@pengwynn pengwynn merged commit 2547ed4 into master Dec 14, 2014
@pengwynn pengwynn deleted the testify branch December 14, 2014 18:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants