Skip to content

Commit

Permalink
tests, README
Browse files Browse the repository at this point in the history
  • Loading branch information
helixbass authored and cmyr committed Nov 17, 2022
1 parent 0ea81a9 commit 4d33fae
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ debug = true
As usual, thanks to Clap, running `cargo instruments -h` prints the compact help.

```
cargo-instruments 0.4.5
cargo-instruments 0.4.8
Profile a binary with Xcode Instruments.
By default, cargo-instruments will build your main binary.
Expand All @@ -150,6 +150,9 @@ OPTIONS:
--bin <NAME> Binary to run
--example <NAME> Example binary to run
--features <CARGO-FEATURES> Features to pass to cargo
--manifest-path <PATH> Path to Cargo.toml
-p, --package <NAME> Specify package for example/bin/bench
--profile <NAME> Pass --profile NAME to cargo
-t, --template <TEMPLATE> Specify the instruments template to run
--time-limit <MILLIS> Limit recording time to the specified value (in milliseconds)
-o, --output <PATH> Output .trace file to the given path
Expand All @@ -158,7 +161,7 @@ ARGS:
<ARGS>... Arguments passed to the target binary
EXAMPLE:
cargo instruments -t time Profile main binary with the (recommended) Time Profiler
cargo instruments -t time Profile main binary with the (recommended) Time Profiler.
```

And `cargo instruments --help` provides more detail.
Expand Down
17 changes: 17 additions & 0 deletions src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ mod tests {
assert!(!opts.release);
assert!(opts.trace_filepath.is_none());
assert!(opts.package.is_none());
assert!(opts.manifest_path.is_none());
}

#[test]
Expand Down Expand Up @@ -322,4 +323,20 @@ mod tests {
assert_eq!(opts.time_limit, Some(808));
assert_eq!(opts.target_args, vec!["hi", "-h", "--bin"]);
}

#[test]
fn manifest_path() {
let opts = AppConfig::from_iter(&[
"instruments",
"--manifest-path",
"/path/to/Cargo.toml",
"--template",
"alloc",
]);
assert!(opts.example.is_none());
assert!(opts.bin.is_none());
assert!(opts.bench.is_none());
assert!(opts.package.is_none());
assert_eq!(opts.manifest_path.unwrap(), PathBuf::from("/path/to/Cargo.toml"));
}
}

0 comments on commit 4d33fae

Please sign in to comment.