Improvements to DiskCache tests #193
Merged
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.
Since I've been doing some work on the disk.rs module, I've noticed the tests could be improced, both in what's being tested and the descriptiveness of the tests.
In this PR, I haven't changed the functionality of the existing tests, but I've made improvements:
'left != right"
from std.Also, I've added a test for the refreshing functionality.
Just as a note, another way in which the tests can be improved would be to be more specific in what the tests are actually testing, i.e. currently all the tests check that getting a non existent key returns none, but ideally we should have one test for that, and then not tests that behaviour in other tests, i.e. each test should test one thing, and its name should explain what that thing is.
What I'd like to do, if / when I get some time would be to look into having a generic test suite for any cache, and then just plug any specific caching implementation (disk, memory, redis, etc...) into those tests.
Just as a reference: Luca Palmieri has a really nice set of exercises in his testing workshop, which is where I learned about googletest.