1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-27 11:52:43 +00:00
starship/benches/benchmarks.rs
2019-04-04 21:35:24 -04:00

46 lines
1.1 KiB
Rust

#![feature(test)]
extern crate test;
#[cfg(test)]
mod tests {
use clap::{App, Arg};
use starship::{modules, print};
use test::Bencher;
#[bench]
fn full_prompt_bench(b: &mut Bencher) {
b.iter(|| {
let args = App::new("starship")
.arg(Arg::with_name("status_code"))
.get_matches_from(vec!["starship", "0"]);
starship::print::prompt(args)
});
}
#[bench]
fn char_section_bench(b: &mut Bencher) {
b.iter(|| {
let args = App::new("starship")
.arg(Arg::with_name("status_code"))
.get_matches_from(vec!["starship", "0"]);
let segment = modules::handle("char", &args);
print::stringify_segment(segment)
});
}
#[bench]
fn dir_section_bench(b: &mut Bencher) {
b.iter(|| {
let args = App::new("starship")
.arg(Arg::with_name("status_code"))
.get_matches_from(vec!["starship", "0"]);
let segment = modules::handle("dir", &args);
print::stringify_segment(segment)
});
}
}