From 43d7c4f4ca47f06c259ec80c0fc7126222fa9fd3 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 21 Nov 2021 16:06:48 -0500 Subject: [PATCH] Update grep tests to use fake parent process command --- src/handlers/grep.rs | 561 ++++++++++++++++++++++++++----------------- 1 file changed, 335 insertions(+), 226 deletions(-) diff --git a/src/handlers/grep.rs b/src/handlers/grep.rs index c11ad9c8f..25c41614d 100644 --- a/src/handlers/grep.rs +++ b/src/handlers/grep.rs @@ -423,64 +423,83 @@ pub fn _parse_grep_line<'b>(regex: &Regex, line: &'b str) -> Option #[cfg(test)] mod tests { use crate::handlers::grep::{parse_grep_line, GrepLine, LineType}; + use crate::utils::process::tests::cfg; #[test] fn test_parse_grep_match() { - assert_eq!( - parse_grep_line("src/co-7-fig.rs:xxx"), - Some(GrepLine { - path: "src/co-7-fig.rs".into(), - line_number: None, - line_type: LineType::Match, - code: "xxx".into(), - submatches: None, - }) - ); - assert_eq!( - parse_grep_line("src/config.rs:use crate::minusplus::MinusPlus;"), - Some(GrepLine { - path: "src/config.rs".into(), - line_number: None, - line_type: LineType::Match, - code: "use crate::minusplus::MinusPlus;".into(), - submatches: None, - }) - ); - assert_eq!( - parse_grep_line( - "src/config.rs: pub line_numbers_style_minusplus: MinusPlus