This is also the recommended way of structuring things in Rust. It works pretty nicely.
Not too dirty (ahem...) and allows you to test various internal parts. And I must admit I got the idea after looking into Rust :)
All the tests end up in the "release" binary, along with the application code. Separate test_main entry point to run the tests instead of the application. If I don't want the tests available, marking test_main static and deadstripping rips them all out.