Hacker News new | ask | show | jobs
by Rompect 1889 days ago
Actually, it's possible and even frequently used, for example in lazy-static, through the `doc_comment` crate.

    #[cfg(doctest)]
    #[macro_use]
    extern crate doc_comment;
    
    #[cfg(doctest)]
    doctest!("../README.md");
Now, the readme examples are tested like everything else.

https://github.com/rust-lang-nursery/lazy-static.rs/blob/mas...