Inline tests are convenient — until your files grow too large.
Manually ejecting means editing one file and creating another. That's busywork.
$ cargo install ejectest
$ ejectest src/lib.rs
pub fn add(a: i32, b: i32) -> i32 { a + b } #[cfg(test)] mod tests { use super::*; #[test] fn test_add() { assert_eq!(add(1, 2), 3); } }
pub fn add(a: i32, b: i32) -> i32 { a + b } #[cfg(test)] #[path = "lib_tests.rs"] mod tests;
use super::*;
#[test]
fn test_add() {
assert_eq!(add(1, 2), 3);
}