Skip to main content

doc_test/
lib.rs

1//! # This is my crate
2//!
3//! Blah blah blah, more description of the crate.
4
5/// Adds one to the number given.
6///
7/// # Examples
8/// ```
9/// let arg = 5;
10/// let result = doc_test::add_one(arg);
11///
12/// assert_eq!(result, 6);
13/// ```
14pub fn add_one(x: i32) -> i32 {
15    x + 1
16}
17
18#[cfg(test)]
19mod tests {
20    use super::*;
21
22    #[test]
23    fn basic() {
24        assert_eq!(2 + 2, 4);
25    }
26}