Sometimes, we want to test that a function will panic. To do so, we can simply add the #[should_panic] attribute at the top of the test function:
#[should_panic] #[test] fn test_dummy() { assert!(false, "Always fail"); }
When doing so, the test now passes:
Finished dev [unoptimized + debuginfo] target(s) in 1.30 secs Running target/debug/deps/ftp_server-452667ddc2d724e8 running 2 tests test codec::tests::test_dummy ... ok test codec::tests::test_encoder ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out