summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-12-13 23:05:53 -0500
committerDan Davison <dandavison7@gmail.com>2021-12-13 23:21:31 -0500
commitbc8676dd4de9775c9327ca6c72936d6846ee7cf0 (patch)
tree9af997cca80ef5ad0e21238da04d33c6635b28bb
parentcf270eefd9bf8dccbd08af9d25fb47d552758a36 (diff)
-rw-r--r--src/handlers/hunk.rs51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/handlers/hunk.rs b/src/handlers/hunk.rs
index cb7d36c6..9f644eea 100644
--- a/src/handlers/hunk.rs
+++ b/src/handlers/hunk.rs
@@ -306,6 +306,57 @@ mod tests {
);
}
+ #[test]
+ fn test_hunk_line_style_raw() {
+ DeltaTest::with(&["--minus-style", "raw", "--plus-style", "raw"])
+ .with_input(GIT_DIFF_WITH_COLOR)
+ .explain_ansi()
+ .expect_skip(
+ 14,
+ "
+(red)aaa(normal)
+(green)bbb(normal)
+",
+ );
+ }
+
+ #[test]
+ fn test_hunk_line_style_raw_map_styles() {
+ DeltaTest::with(&[
+ "--minus-style",
+ "raw",
+ "--plus-style",
+ "raw",
+ "--map-styles",
+ "red => bold blue, green => dim yellow",
+ ])
+ .with_input(GIT_DIFF_WITH_COLOR)
+ .explain_ansi()
+ .expect_skip(
+ 14,
+ "
+(bold blue)aaa(normal)
+(dim yellow)bbb(normal)
+",
+ );
+ }
+
+ const GIT_DIFF_WITH_COLOR: &str = r#"\
+commit 3ef7fba7258fe473f1d8befff367bb793c786107
+Author: Dan Davison <dandavison7@gmail.com>
+Date: Mon Dec 13 22:54:43 2021 -0500
+
+ 753 Test file
+
+diff --git a/file b/file
+index 72943a1..f761ec1 100644
+--- a/file
++++ b/file
+@@ -1 +1 @@
+-aaa
++bbb
+"#;
+
const GIT_DIFF_COLOR_WORDS: &str = r#"\
commit 6feea4949c20583aaf16eee84f38d34d6a7f1741
Author: Dan Davison <dandavison7@gmail.com>