-
Notifications
You must be signed in to change notification settings - Fork 1k
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! 👍 |
CLAs look good, thanks! |
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.
looks pretty good! i would like to see some test cases that cover this, though. it might be best to wait until #287 goes in, though (which will hopefully be tonight or tomorrow), as that will provide a more structured way of creating such tests.
cmd/dep/ensure.go
Outdated
} | ||
|
||
if len(m) == pkgErrors { | ||
return fmt.Errorf("all dirs had go code with errors") |
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.
No need for Errorf()
when there's no variables being interpolated happening. Just errors.New()
is fine
(Also, no need to include the issue number in the commit message) |
Thanks @sdboyer , I did try to drive the functionality via tests but got a little lost. Will wait for the test improvements and give it another bash. Thanks. |
So the reason I was unsure on the tests is that in the My natural instinct would be to always test from the public Could you advise me on how best to test this bug fix? Sorry if I'm overcomplicating things. |
@domgreen (new testing harness is in)
For the most part, we've been doing full-on integration tests here. They have mostly the same effect as calling that Have a look at the docs for writing a test using the new harness. Basically, you need to put down a certain pattern of files on disk. |
No problem will follow that pattern, I did look at the new code which looks straight foward in most cases. I will see how I can get the error message displayed from the output. As I expect that I would want to assert that the error is present as well as the file system being in the correct state. |
That is a test harness "feature" that definitely needs to be added - expected error cases. (Right now, the few there are still code-based tests.) It's on my todo list, but if you want to take a crack at it, let me know.
|
I didn't mean to close :\ having git issues after rebasing master onto my fork |
So, case3 to me doesn't really test what I wanted to test ... as @tro3 says maybe I should look into the test harness to see how I can get it to expect errors 👍 This isn't a lunch time jobbie, will get some time either tonight or tomorrow to see if I can add that in. |
Capturing the stdout is pretty easy - test.DoRun already prints the output if the -logs flag is set. The bigger issues are the parsing and -update options, the latter being why I put it off for a future PR. I may get a couple hours this afternoon and take a crack - I already have it "planned", I just suspect a landmine in the plan.
|
Thanks, will read through the code anyway to see what I can grok and think of how I would do it. I have created a new branch for myself as well to have a "tinker". |
@domgreen, would you like to carve it up between us? If I work on the -update of the |
I wouldnt mind giving it a bash 😸 I will do it as a new PR, very new to go (this is the first go code ive written) so may pester you abit on the PR. If that is okay for you then I will look over the weekend. |
@sdboyer would like to pick this up again as well 👍 (will start a new PR) |
Have tested locally by running
go test
in the source dirs and also testing manually by using../../../../bin/dep ensure
in a test repo.Fixes #241