diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-12-13 23:05:53 -0500 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2021-12-13 23:21:31 -0500 |
commit | bc8676dd4de9775c9327ca6c72936d6846ee7cf0 (patch) | |
tree | 9af997cca80ef5ad0e21238da04d33c6635b28bb | |
parent | cf270eefd9bf8dccbd08af9d25fb47d552758a36 (diff) |
Add Test for #753 3ce64ddefb896f8a64013deb78235b4dda1d0fb8
-rw-r--r-- | src/handlers/hunk.rs | 51 |
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#"\ +[33mcommit 3ef7fba7258fe473f1d8befff367bb793c786107[m +Author: Dan Davison <dandavison7@gmail.com> +Date: Mon Dec 13 22:54:43 2021 -0500 + + 753 Test file + +[1mdiff --git a/file b/file[m +[1mindex 72943a1..f761ec1 100644[m +[1m--- a/file[m +[1m+++ b/file[m +[31m@@ -1 +1 @@[m +[31m-aaa[m +[32m+[m[32mbbb[m +"#; + const GIT_DIFF_COLOR_WORDS: &str = r#"\ [33mcommit 6feea4949c20583aaf16eee84f38d34d6a7f1741[m Author: Dan Davison <dandavison7@gmail.com> |