Hacker News new | ask | show | jobs
by JoshTriplett 3400 days ago
I prefer to keep tests in a `mod tests { ... }` block at the end of the source file, which provides comparable benefits and separation. I also prefer to use `combobulator.rs` rather than `combobulator/mod.rs`, for multiple reasons including filename ambiguity. In this case, you'd have:

    src/main.rs
    src/combobulator.rs
    src/somethingelse.rs
2 comments

Too much code in one place. Makes it hard to read the file and difficult to see what is code and what are tests. `wc` can no longer give you a quick approximation of code size either.
In case you didn't see, I mentioned there is a way to do this right now:

https://news.ycombinator.com/item?id=13791945

So I can keep a separate src/ and tests/ hierarchy? Why are the rust people so insistent on this even though most seen to want to could their test and src trees.
I think this is a very common standard. At least, its what I have seen most often.