-
Notifications
You must be signed in to change notification settings - Fork 1k
tests: better coverage across the board #41
Comments
adding the good first pr label, because test could be added for any function, big or small, we also have a framework for integration testing where you could easily copy paste another test and change some things to test something else |
Looks like Context.LoadProject is uncovered. Any particular reason? If not, I can work on a unit test for that one after I figure out how you've all set up / torn down test files for os calls in other tests. Sound okay? |
@tro3 no reason for it :) that's be a great help - you'd effectively be codifying some very important rules about how we decide what the boundaries of projects. Thanks! |
No problem. Do you have a doc as to what the intended behavior is, or would you prefer I use the existing code as the "spec" and write tests to cover it and guard against future breakage? |
@tro3 nope, no actual spec for it, so best to take code as spec and work from there. ideally...if you have time 😄 ...you could also write up some docs explaining how it works, so that we can sorta retro-spec it. would ease discussions about it in the future, and/or contribute to the docs that we are sorely lacking |
Will do. One question - I assume the lock file is supposed to always be in the same directory as the manifest? If so, there is a bug when locating the root while ascending. |
I was just working on some initial tests for LoadProject. I can create a PR for that if that's ok, and expand cases from there. |
Sure, no problem. It was more of an accident. I looked at the open issues, spotted this one and started working on that function just to get a feeling of the code structure, etc. I'll look at the coverage for other functions and post here before writing anything else :-) |
* TestCopyDir: add subdirectory to the test case; extend test to handle multiple files in different directories. * Add tests for error conditions in CopyDir: source directory cannot be read; destination directory cannot be read; files cannot be read. * Add tests for error conditions in IsRegular. * Add tests for error conditions in IsDir. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
Test error conditions: * Manifest file cannot be read * Manifest file is invalid This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
* Add tests for "required" field in manifest file (Required field in Manifest is already there). * Add tests checking that gps.Manifest interface is implemented in a way that makes sense. * Check that IgnoredPackages() method is doing the right thing. * Check that Overrides() method is doing the right thing. * Check that RequiredPackages() method is doing the right thing. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
* Add tests for "required" field in manifest file (Required field in Manifest is already there). * Add tests checking that gps.Manifest interface is implemented in a way that makes sense. * Check that IgnoredPackages() method is doing the right thing. * Check that Overrides() method is doing the right thing. * Check that RequiredPackages() method is doing the right thing. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
I think we're doing much better with this now, especially with the harness. I'm gonna close this out in favor of more specific issues 😄 |
* TestCopyDir: add subdirectory to the test case; extend test to handle multiple files in different directories. * Add tests for error conditions in CopyDir: source directory cannot be read; destination directory cannot be read; files cannot be read. * Add tests for error conditions in IsRegular. * Add tests for error conditions in IsDir. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
Test error conditions: * Manifest file cannot be read * Manifest file is invalid This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
* TestCopyDir: add subdirectory to the test case; extend test to handle multiple files in different directories. * Add tests for error conditions in CopyDir: source directory cannot be read; destination directory cannot be read; files cannot be read. * Add tests for error conditions in IsRegular. * Add tests for error conditions in IsDir. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
* TestCopyDir: add subdirectory to the test case; extend test to handle multiple files in different directories. * Add tests for error conditions in CopyDir: source directory cannot be read; destination directory cannot be read; files cannot be read. * Add tests for error conditions in IsRegular. * Add tests for error conditions in IsDir. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
Test error conditions in Analyzer.DeriveManifestAndLock(...): * Manifest file does not exist * Manifest file cannot be read * Manifest file is invalid Add test for Analyzer.Info() to make sure that changes to name or version do not go unnoticed. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
Test error conditions in Analyzer.DeriveManifestAndLock(...): * Manifest file does not exist * Manifest file cannot be read * Manifest file is invalid Add test for Analyzer.Info() to make sure that changes to name or version do not go unnoticed. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
Test error conditions in Analyzer.DeriveManifestAndLock(...): * Manifest file does not exist * Manifest file cannot be read * Manifest file is invalid Add test for Analyzer.Info() to make sure that changes to name or version do not go unnoticed. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
* TestCopyDir: add subdirectory to the test case; extend test to handle multiple files in different directories. * Add tests for error conditions in CopyDir: source directory cannot be read; destination directory cannot be read; files cannot be read. * Add tests for error conditions in IsRegular. * Add tests for error conditions in IsDir. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
* TestCopyDir: add subdirectory to the test case; extend test to handle multiple files in different directories. * Add tests for error conditions in CopyDir: source directory cannot be read; destination directory cannot be read; files cannot be read. * Add tests for error conditions in IsRegular. * Add tests for error conditions in IsDir. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
Test error conditions in Analyzer.DeriveManifestAndLock(...): * Manifest file does not exist * Manifest file cannot be read * Manifest file is invalid Add test for Analyzer.Info() to make sure that changes to name or version do not go unnoticed. This addresses issue golang#41. Signed-off-by: Marcelo E. Magallon <[email protected]>
Adding the good-first-pr label, because test could be added for any function, big or small, we also have a framework for integration testing where you could easily copy paste another test and change some things to test something else.
Here is an example of an integration test: https://github.com/golang/dep/blob/master/remove_test.go#L9
If you want to write a test, just write here what you wish to test so no one takes the same one :)
The text was updated successfully, but these errors were encountered: