mirror of
https://github.com/starship/starship.git
synced 2024-11-27 02:35:25 +01:00
794ae7b2ad
### 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
30 lines
738 B
Rust
30 lines
738 B
Rust
use ansi_term::Color;
|
|
use starship::segment::Segment;
|
|
use std::path::Path;
|
|
|
|
mod common;
|
|
|
|
#[test]
|
|
fn char_section_success_status() {
|
|
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]
|
|
fn char_section_failure_status() {
|
|
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);
|
|
}
|