-
Notifications
You must be signed in to change notification settings - Fork 207
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
[1/2] Add tests for user-facing behavior #70
Merged
Merged
Commits on May 26, 2017
-
[1/2] Add tests for user-facing behavior
TL;DR: This PR adds integration tests, which fail. Fixing the tests is a much larger change made in a separate PR. As I was working on some Fx modules that use dig, I noticed some behavior that surprised me. In exploring dig's code, I realized that many of my assumptions about how the library should behave aren't covered by dig's testing suite. In this PR, I've added a bunch of end-to-end tests in the top-level dig package. Those tests *only* use the public `Provide` and `Invoke` APIs to verify that the behaviors Fx needs work correctly. I haven't altered any of dig's production code. Unfortunately, these tests exposed a number of bugs: ``` $ go test . | grep FAIL # Container.Provide(nil) panics. --- FAIL: TestCantProvideUntypedNil (0.00s) # The container allows us to provide errors, but via some code paths. --- FAIL: TestCantProvideErrors (0.00s) # All types in the graph must have their deps satisfied, even if nobody's # using them. --- FAIL: TestIncompleteGraphIsOkay (0.00s) # Container doesn't detect cycles. --- FAIL: TestProvideCycleFails (0.00s) --- FAIL: TestEndToEndSuccess (0.00s) # We can't provide slices or maps from standard constructor functions, but # we can provide instances. Elaborate constructors like `func() []Foo, int, # error` also work correctly. --- FAIL: TestEndToEndSuccess/slice_constructor (0.00s) --- FAIL: TestEndToEndSuccess/map_constructor (0.00s) # We can't provide both []Foo and Foo, since dig considers them the same # type. --- FAIL: TestEndToEndSuccess/collections_and_instances_of_same_type (0.00s) ``` This is concerning to me, since dig has 89% code coverage. Fixing these bugs and structuring the code so that we can confidently refactor without breaking user-facing behavior was a larger change, so I've broken it out into a separate PR.
Akshay Shah committedMay 26, 2017 Configuration menu - View commit details
-
Copy full SHA for cc5eac8 - Browse repository at this point
Copy the full SHA cc5eac8View commit details
Commits on May 30, 2017
-
Akshay Shah committed
May 30, 2017 Configuration menu - View commit details
-
Copy full SHA for ec46812 - Browse repository at this point
Copy the full SHA ec46812View commit details
Commits on May 31, 2017
-
Configuration menu - View commit details
-
Copy full SHA for 850b9e0 - Browse repository at this point
Copy the full SHA 850b9e0View commit details -
Configuration menu - View commit details
-
Copy full SHA for a9fc2ca - Browse repository at this point
Copy the full SHA a9fc2caView commit details -
Configuration menu - View commit details
-
Copy full SHA for 88f3cd0 - Browse repository at this point
Copy the full SHA 88f3cd0View commit details -
Configuration menu - View commit details
-
Copy full SHA for a5a8e37 - Browse repository at this point
Copy the full SHA a5a8e37View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6899b6e - Browse repository at this point
Copy the full SHA 6899b6eView commit details -
Configuration menu - View commit details
-
Copy full SHA for aee8ee9 - Browse repository at this point
Copy the full SHA aee8ee9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 849e746 - Browse repository at this point
Copy the full SHA 849e746View commit details -
Configuration menu - View commit details
-
Copy full SHA for e3bfd0c - Browse repository at this point
Copy the full SHA e3bfd0cView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.