Print output to stdout

Let's see what happens when we add a call to println!() in our test (for debug purposes, for instance):

#[test]
fn test_pwd() {
    println!("Running FTP server");

    // …
}

It will not be printed to the terminal. In order to see it, we need to pass another parameter to the test runner. Let's run cargo test this way to see the output to stdout:

cargo run -- --nocapture

This time, we see the following output:

…

     Running target/debug/deps/server-1b5cda64792f5f82

running 1 test
Running FTP server
Waiting clients on port 1234...
New client: [address : 127.0.0.1:43304]
Waiting another client...
Received command: Pwd
Received command: User("ferris")
Received command: Cwd("src")
Received command: Pwd
Received command: CdUp
Received command: Pwd
Received command: Quit
test test_pwd ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out