summaryrefslogtreecommitdiffstats
path: root/src/modules/character.rs
diff options
context:
space:
mode:
authorMatan Kushner <hello@matchai.me>2019-04-15 20:54:52 -0400
committerGitHub <noreply@github.com>2019-04-15 20:54:52 -0400
commit794ae7b2ad3d79009162fa7f2d4fe24997f7c2d1 (patch)
tree8a60c56f3092c1c21844bd5d842b4b328b67c6ea /src/modules/character.rs
parentab5490bea691d6c5fbe525a54799c17d4bd76dca (diff)
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
Diffstat (limited to 'src/modules/character.rs')
-rw-r--r--src/modules/character.rs29
1 files changed, 2 insertions, 27 deletions
diff --git a/src/modules/character.rs b/src/modules/character.rs
index 53a43e886..359ff61fb 100644
--- a/src/modules/character.rs
+++ b/src/modules/character.rs
@@ -1,6 +1,7 @@
use super::Segment;
use ansi_term::Color;
use clap::ArgMatches;
+use std::path::Path;
/// Creates a segment for the prompt character
///
@@ -10,7 +11,7 @@ use clap::ArgMatches;
/// (green by default)
/// - If the exit-code was anything else, the arrow will be formatted with
/// `COLOR_FAILURE` (red by default)
-pub fn segment(args: &ArgMatches) -> Option<Segment> {
+pub fn segment(_current_dir: &Path, args: &ArgMatches) -> Option<Segment> {
const PROMPT_CHAR: &str = "➜";
const COLOR_SUCCESS: Color = Color::Green;
const COLOR_FAILURE: Color = Color::Red;
@@ -27,29 +28,3 @@ pub fn segment(args: &ArgMatches) -> Option<Segment> {
Some(segment)
}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use clap::{App, Arg};
-
- #[test]
- fn char_section_success_status() {
- let args = App::new("starship")
- .arg(Arg::with_name("status_code"))
- .get_matches_from(vec!["starship", "0"]);
-
- let segment = segment(&args);
- // assert_eq!(segment.style, Style::from(Color::Green));
- }
-
- #[test]
- fn char_section_failure_status() {
- let args = App::new("starship")
- .arg(Arg::with_name("status_code"))
- .get_matches_from(vec!["starship", "1"]);
-
- let segment = segment(&args);
- // assert_eq!(segment.style, Style::from(Color::Red));
- }
-}