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

tests: Better use of assertErrorMatches #211

Merged
merged 1 commit into from
Sep 19, 2018
Merged

tests: Better use of assertErrorMatches #211

merged 1 commit into from
Sep 19, 2018

Conversation

abhinav
Copy link
Collaborator

@abhinav abhinav commented Sep 19, 2018

The test for DeferAcyclicVerification was making N separate calls to
assertErrorMatches which doesn't verify that the different components of
the error messages appear in the correct order.

This switches to "correct" usage so that we're verifying that the
correct types appear in the error messages at the correct spot. In this
case, we want "C depends on B depends on A depends on C".

The test for DeferAcyclicVerification was making N separate calls to
assertErrorMatches which doesn't verify that the different components of
the error messages appear in the correct order.

This switches to "correct" usage so that we're verifying that the
correct types appear in the error messages at the correct spot. In this
case, we want "C depends on B depends on A depends on C".
@codecov
Copy link

codecov bot commented Sep 19, 2018

Codecov Report

Merging #211 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #211   +/-   ##
=======================================
  Coverage   98.93%   98.93%           
=======================================
  Files           9        9           
  Lines        1032     1032           
=======================================
  Hits         1021     1021           
  Misses          9        9           
  Partials        2        2

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ecfd21...8a58ced. Read the comment docs.

@abhinav abhinav requested a review from glibsm September 19, 2018 20:22
Copy link
Collaborator

@glibsm glibsm left a comment

Choose a reason for hiding this comment

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

nice!

@@ -1626,14 +1626,9 @@ func TestProvideCycleFails(t *testing.T) {
assert.True(t, IsCycleDetected(err))
assertErrorMatches(t, err,
`cycle detected in dependency graph:`,
)
assertErrorMatches(t, err,
`\*dig.C provided by "go.uber.org/dig".TestProvideCycleFails.\S+ \(\S+\)`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

(\S+:\D+\) for file:line is better than just (<whatever>) but that's not in the scope of this PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't want to be overly specific there in case we decide to add more information in the parens.

@abhinav abhinav merged commit 007ab72 into master Sep 19, 2018
@abhinav abhinav deleted the abg/testfix branch September 19, 2018 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants