1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-09 14:51:04 +00:00
starship/tests/common.rs
Matan Kushner 794ae7b2ad
Add integration tests (#6)
### Changed
- Added current_dir param to segments to make them more testable
- Moved all existing integration tests to a `tests/` dir

### Added
- A whole bunch of new integration tests
2019-04-15 20:54:52 -04:00

19 lines
538 B
Rust

use clap::{App, Arg};
use starship::modules;
use std::path::Path;
pub fn render_segment(module: &str, path: &Path) -> String {
render_segment_with_status(module, path, "0")
}
pub fn render_segment_with_status(module: &str, path: &Path, status: &str) -> String {
// Create an `Arg` with status_code of "0"
let args = App::new("starship")
.arg(Arg::with_name("status_code"))
.get_matches_from(vec!["starship", status]);
let segment = modules::handle(module, path, &args);
segment.unwrap().output()
}