Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matan Kushner
committed
Apr 4, 2019
1 parent
7136059
commit 52a529c
Showing
5 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#![feature(test)] | ||
|
||
extern crate test; | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use starship::{modules, print}; | ||
use test::Bencher; | ||
use clap::{App, Arg}; | ||
|
||
#[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::print_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::print_segment(segment) | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod modules; | ||
pub mod print; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#[macro_use] | ||
extern crate clap; | ||
extern crate ansi_term; | ||
|
||
mod modules; | ||
mod print; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters