Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created November 6, 2019 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rust-play/63b7c03e38c047ceb0aab053d9fd2485 to your computer and use it in GitHub Desktop.
Save rust-play/63b7c03e38c047ceb0aab053d9fd2485 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
// You can run a single test by passing the name of that test to `cargo test`
#[test]
fn does_stuff() {
let t: bool = true;
t
}
// To run this test from the command line:
// cargo test does_stuff
// You can run multiple tests by passing a substring of the tests names
#[test]
fn does_some_stuff() {
let t: bool = true;
t
}
#[test]
fn does_other_stuff() {
let t: bool = true;
t
}
// To run both of these tests from the command line:
// cargo test does_
// To use `println` and not have it destroyed by the Rust test harness use `-- --nocapture`
#[test]
fn wow_test() {
let t: bool = true;
println!("{:#?}", t);
t
}
// cargo test wow_test -- --nocapture
// true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment