Install

Example

Run Demo

  1. Use rustc
1
2
3
fn main(){
println!("hello world")
}
  1. Use Cargo
1
2
3
cargo new hello
cd hello
cargo run

Test Demo

  • mkdir tests
  • vim tests/cli.rs
1
2
3
4
5
6
7
8
use std::process::Command;

#[test]
fn work(){
let mut cmd = Command::new("ls");
let res = cmd.output();
assert!(res.is_ok());
}
  • cargo test

Adding a project dependency