2019-04-16 00:54:52 +00:00
|
|
|
use ansi_term::Color;
|
|
|
|
use starship::segment::Segment;
|
|
|
|
use std::path::Path;
|
|
|
|
|
|
|
|
mod common;
|
|
|
|
|
|
|
|
#[test]
|
2019-04-23 18:51:08 +00:00
|
|
|
fn char_segment_success_status() {
|
2019-04-16 00:54:52 +00:00
|
|
|
let dir = Path::new("~");
|
|
|
|
let expected = Segment::new("char")
|
|
|
|
.set_value("➜")
|
|
|
|
.set_style(Color::Green)
|
|
|
|
.set_prefix(None)
|
|
|
|
.output();
|
|
|
|
let actual = common::render_segment_with_status("char", &dir, "0");
|
|
|
|
assert_eq!(expected, actual);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2019-04-23 18:51:08 +00:00
|
|
|
fn char_segment_failure_status() {
|
2019-04-16 00:54:52 +00:00
|
|
|
let dir = Path::new("~");
|
|
|
|
let expected = Segment::new("char")
|
|
|
|
.set_value("➜")
|
|
|
|
.set_style(Color::Red)
|
|
|
|
.set_prefix(None)
|
|
|
|
.output();
|
|
|
|
let actual = common::render_segment_with_status("char", &dir, "1");
|
|
|
|
assert_eq!(expected, actual);
|
|
|
|
}
|