1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//! This is a first-step crate.

#![crate_name = "rust_docker_sample"]

/// Returns an string which has same value with an arugment msg.
///
/// # Arguments
/// * `msg` - A string slice
///
/// # Examples
///
/// ```
/// use rust_docker_sample::echo;
/// let msg: &str = "msg...";
/// let echo_msg = echo(msg);
///```
///
pub fn echo(msg: &str) -> String {
    String::from(msg)
}

#[cfg(test)]
mod tests {
    use crate::echo;

    #[test]
    fn test_echo() {
        let msg: &str = "yo man";
        let echo_msg = echo(msg);
        assert!(echo_msg == "yo man");
    }
}