-
Notifications
You must be signed in to change notification settings - Fork 67
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
ISSUE-16 - Further unit testing #126
Changes from 2 commits
cfe186f
ef60a53
fd33ad4
91b8aee
536ef33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,11 @@ cargo-platform = "0.1.1" | |
colored = "2.0.0" | ||
console = "0.11.3" | ||
env_logger = "0.7.1" | ||
fake = { version = "2.2", features=["derive"] } | ||
geiger = { path = "../geiger", version = "0.4.5" } | ||
petgraph = "0.5.1" | ||
pico-args = "0.3.3" | ||
rand = "0.7.3" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be a dev-dependency instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, apologies, I had meant to remove that, I have taken out in the last commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great! |
||
serde = { version = "1.0.116", features = ["derive"] } | ||
serde_json = "1.0.57" | ||
strum = "0.19.2" | ||
|
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.
I'm not sure about this library, seems obfuscate the code rather than add value, in my opinion.
How would the code look without the new
fake
dependency?Convince me that I'm wrong :)
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.
I was 50/50 on this library, I really didn't like the fact that it didn't support being added as a dev-dependency for something which was only used in testing.
I came down on the side of including it for how much simpler it made creating large structs in unit tests, for example https://github.com/rust-secure-code/cargo-geiger/pull/126/files#diff-373099d9a5cf5c2a276c879a94c76bdbd5dab804f2dca1ad72776f3b6ea4cb7bR195 for the relative cost of adding derive statement.
If I wasn't to use this, I'd probably create a fixture method with rstest to initialise the default struct, and then inject it into each test.
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.
This alone makes it unfit for use, imho. Making users wait for extra bloat to compile while installing is a bad user experience. Let's go for some extra manually written test code and avoid the
fake
crate.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.
Yeah, that definitely makes sense, I've removed it in the last commit.