diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-06-02 08:21:07 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-06-02 10:47:36 -0400 |
commit | 728afaf2ea92505978c1acdccf243be0ed89d671 (patch) | |
tree | 71bc1019fb5a8bd48137af2799958b1cdece1ef5 /src/tests | |
parent | 8b27a93751d038a5818df3d9340b4b48763b2970 (diff) |
Add failing tests of compositional options: --element-style='box ul'
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_example_diffs.rs | 136 |
1 files changed, 133 insertions, 3 deletions
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs index 0711e010..ccce4e47 100644 --- a/src/tests/test_example_diffs.rs +++ b/src/tests/test_example_diffs.rs @@ -317,11 +317,27 @@ commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e } #[test] - fn test_commit_style_box_deprecated_options() { + fn test_commit_style_box_ul() { + let mut options = integration_test_utils::get_command_line_options(); + options.commit_style = "blue".to_string(); + options.commit_decoration_style = "blue box ul".to_string(); + _do_test_commit_style_box_ul(options); + } + + #[test] + fn test_commit_style_box_ol() { + let mut options = integration_test_utils::get_command_line_options(); + options.commit_style = "blue".to_string(); + options.commit_decoration_style = "blue box ol".to_string(); + _do_test_commit_style_box_ol(options); + } + + #[test] + fn test_commit_style_box_ul_deprecated_options() { let mut options = integration_test_utils::get_command_line_options(); options.deprecated_commit_color = Some("blue".to_string()); options.commit_style = "box".to_string(); - _do_test_commit_style_box(options); + _do_test_commit_style_box_ul(options); } fn _do_test_commit_style_box(options: cli::Opt) { @@ -343,6 +359,39 @@ commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e ansi_test_utils::assert_line_has_style( &output, 2, + "────────────────────────────────────────────────┘", + "blue", + &config, + ); + let output = strip_ansi_codes(&output); + assert!(output.contains( + "\ +────────────────────────────────────────────────┐ +commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e │ +────────────────────────────────────────────────┘ +" + )); + } + + fn _do_test_commit_style_box_ul(options: cli::Opt) { + let (output, config) = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, options); + ansi_test_utils::assert_line_has_style( + &output, + 0, + "────────────────────────────────────────────────┐", + "blue", + &config, + ); + ansi_test_utils::assert_line_has_style( + &output, + 1, + "commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e │", + "blue", + &config, + ); + ansi_test_utils::assert_line_has_style( + &output, + 2, "────────────────────────────────────────────────┴─", "blue", &config, @@ -356,6 +405,39 @@ commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e │ )); } + fn _do_test_commit_style_box_ol(options: cli::Opt) { + let (output, config) = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, options); + ansi_test_utils::assert_line_has_style( + &output, + 0, + "────────────────────────────────────────────────┬─", + "blue", + &config, + ); + ansi_test_utils::assert_line_has_style( + &output, + 1, + "commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e │", + "blue", + &config, + ); + ansi_test_utils::assert_line_has_style( + &output, + 2, + "────────────────────────────────────────────────┘", + "blue", + &config, + ); + let output = strip_ansi_codes(&output); + assert!(output.contains( + "\ +────────────────────────────────────────────────┬─ +commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e │ +────────────────────────────────────────────────┘ +" + )); + } + #[test] fn test_commit_style_box_raw() { let mut options = integration_test_utils::get_command_line_options(); @@ -375,6 +457,8 @@ commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e │ )); } + // TODO: test overline + #[test] fn test_commit_style_underline() { let mut options = integration_test_utils::get_command_line_options(); @@ -522,7 +606,23 @@ src/align.rs } #[test] - fn test_file_style_box_deprecated_options() { + fn test_file_style_box_ul() { + let mut options = integration_test_utils::get_command_line_options(); + options.file_style = "green".to_string(); + options.file_decoration_style = "green box ul".to_string(); + _do_test_file_style_box_ul(options); + } + + #[test] + fn test_file_style_box_ol() { + let mut options = integration_test_utils::get_command_line_options(); + options.file_style = "green".to_string(); + options.file_decoration_style = "green box ol".to_string(); + _do_test_file_style_box_ol(options); + } + + #[test] + fn test_file_style_box_ul_deprecated_options() { let mut options = integration_test_utils::get_command_line_options(); options.deprecated_file_color = Some("green".to_string()); options.file_style = "box".to_string(); @@ -533,6 +633,21 @@ src/align.rs let (output, config) = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, options); ansi_test_utils::assert_line_has_style(&output, 7, "─────────────┐", "green", &config); ansi_test_utils::assert_line_has_style(&output, 8, "src/align.rs │", "green", &config); + ansi_test_utils::assert_line_has_style(&output, 9, "─────────────┘", "green", &config); + let output = strip_ansi_codes(&output); + assert!(output.contains( + " +─────────────┐ +src/align.rs │ +─────────────┘ +" + )); + } + + fn _do_test_file_style_box_ul(options: cli::Opt) { + let (output, config) = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, options); + ansi_test_utils::assert_line_has_style(&output, 7, "─────────────┐", "green", &config); + ansi_test_utils::assert_line_has_style(&output, 8, "src/align.rs │", "green", &config); ansi_test_utils::assert_line_has_style(&output, 9, "─────────────┴─", "green", &config); let output = strip_ansi_codes(&output); assert!(output.contains( @@ -543,6 +658,21 @@ src/align.rs │ )); } + fn _do_test_file_style_box_ol(options: cli::Opt) { + let (output, config) = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, options); + ansi_test_utils::assert_line_has_style(&output, 7, "─────────────┬─", "green", &config); + ansi_test_utils::assert_line_has_style(&output, 8, "src/align.rs │", "green", &config); + ansi_test_utils::assert_line_has_style(&output, 9, "─────────────┘", "green", &config); + let output = strip_ansi_codes(&output); + assert!(output.contains( + " +─────────────┬─ +src/align.rs │ +─────────────┘ +" + )); + } + #[test] fn test_file_style_box_raw() { let mut options = integration_test_utils::get_command_line_options(); |