diff options
author | ulwlu <ooulwluoo@gmail.com> | 2020-12-09 02:04:30 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-08 17:04:30 +0000 |
commit | b45ed90542d1389a0cfad0cd22d5c50c7a717d2f (patch) | |
tree | 5ac895d6a2f85e4f2e597d2588fa26d2e7042626 | |
parent | 8cc0c372f4d29b8ced61d92ce7c46527a7180f76 (diff) |
Make commit style to be colored with same structure while color_only #405 (#438)
* Remove force assing raw to commit style when color_only
* Add test for commit style color when color_only
-rw-r--r-- | src/options/set.rs | 1 | ||||
-rw-r--r-- | src/tests/test_example_diffs.rs | 21 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/options/set.rs b/src/options/set.rs index 449619fd..5b68ffec 100644 --- a/src/options/set.rs +++ b/src/options/set.rs @@ -197,7 +197,6 @@ pub fn set_options( opt.side_by_side = false; opt.file_decoration_style = "none".to_string(); opt.commit_decoration_style = "none".to_string(); - opt.commit_style = "raw".to_string(); opt.hunk_header_decoration_style = "none".to_string(); } } diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs index c96a83e0..f4121588 100644 --- a/src/tests/test_example_diffs.rs +++ b/src/tests/test_example_diffs.rs @@ -989,7 +989,6 @@ src/align.rs } #[test] - // TODO: commit-style is required to add. fn test_hunk_header_style_with_color_only_has_style() { let config = integration_test_utils::make_config_from_args(&[ "--color-only", @@ -1010,6 +1009,26 @@ src/align.rs } #[test] + fn test_commit_style_with_color_only_has_style() { + let config = integration_test_utils::make_config_from_args(&[ + "--color-only", + "--commit-style", + "red", + ]); + let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config); + + ansi_test_utils::assert_line_has_style( + &output, + 0, + "commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e", + "red", + &config, + ); + let output = strip_ansi_codes(&output); + assert!(output.contains("commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e")); + } + + #[test] fn test_hunk_header_style_colored_input_color_is_stripped_under_normal() { let config = integration_test_utils::make_config_from_args(&[ "--hunk-header-style", |