diff options
author | Thomas Otto <th1000s@posteo.net> | 2022-02-07 23:11:36 +0100 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2022-02-07 19:35:27 -0500 |
commit | b66d1d371709205525128fcd80ca302630f8ac9e (patch) | |
tree | 47d3bc174996a318598213bffaac869fd0411ba1 /src/features | |
parent | 37dd3391844efefbfe59acbbf3ad661b497ed9ce (diff) |
Fix unused imports and functions warnings on windows
Otherwise these warnings clutter the github diff display.
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/hyperlinks.rs | 91 |
1 files changed, 46 insertions, 45 deletions
diff --git a/src/features/hyperlinks.rs b/src/features/hyperlinks.rs index 587faf9b..2fad166f 100644 --- a/src/features/hyperlinks.rs +++ b/src/features/hyperlinks.rs @@ -111,54 +111,55 @@ fn format_github_commit_url(commit: &str, github_repo: &str) -> String { #[cfg(test)] pub mod tests { - use std::path::PathBuf; + #[cfg(not(target_os = "windows"))] + pub mod unix { + use std::path::PathBuf; - use super::*; - use crate::tests::integration_test_utils; + use super::super::*; + use crate::tests::integration_test_utils; - fn assert_file_hyperlink_matches( - relative_path: &str, - expected_hyperlink_path: &str, - config: &Config, - ) { - let link_text = "link text"; - assert_eq!( - format_osc8_hyperlink( - &PathBuf::from(expected_hyperlink_path).to_string_lossy(), - link_text - ), - format_osc8_file_hyperlink(relative_path, None, link_text, config) - ) - } + fn assert_file_hyperlink_matches( + relative_path: &str, + expected_hyperlink_path: &str, + config: &Config, + ) { + let link_text = "link text"; + assert_eq!( + format_osc8_hyperlink( + &PathBuf::from(expected_hyperlink_path).to_string_lossy(), + link_text + ), + format_osc8_file_hyperlink(relative_path, None, link_text, config) + ) + } - #[test] - #[cfg(not(target_os = "windows"))] - fn test_relative_path_file_hyperlink_when_not_child_process_of_git() { - // The current process is not a child process of git. - // Delta receives a file path 'a'. - // The hyperlink should be $cwd/a. - let mut config = integration_test_utils::make_config_from_args(&[ - "--hyperlinks", - "--hyperlinks-file-link-format", - "{path}", - ]); - config.cwd_of_user_shell_process = Some(PathBuf::from("/some/cwd")); - assert_file_hyperlink_matches("a", "/some/cwd/a", &config) - } + #[test] + fn test_relative_path_file_hyperlink_when_not_child_process_of_git() { + // The current process is not a child process of git. + // Delta receives a file path 'a'. + // The hyperlink should be $cwd/a. + let mut config = integration_test_utils::make_config_from_args(&[ + "--hyperlinks", + "--hyperlinks-file-link-format", + "{path}", + ]); + config.cwd_of_user_shell_process = Some(PathBuf::from("/some/cwd")); + assert_file_hyperlink_matches("a", "/some/cwd/a", &config) + } - #[test] - #[cfg(not(target_os = "windows"))] - fn test_relative_path_file_hyperlink_when_child_process_of_git() { - // The current process is a child process of git. - // Delta receives a file path 'a'. - // We are in directory b/ relative to the repo root. - // The hyperlink should be $repo_root/b/a. - let mut config = integration_test_utils::make_config_from_args(&[ - "--hyperlinks", - "--hyperlinks-file-link-format", - "{path}", - ]); - config.cwd_of_user_shell_process = Some(PathBuf::from("/some/repo-root/b")); - assert_file_hyperlink_matches("a", "/some/repo-root/b/a", &config) + #[test] + fn test_relative_path_file_hyperlink_when_child_process_of_git() { + // The current process is a child process of git. + // Delta receives a file path 'a'. + // We are in directory b/ relative to the repo root. + // The hyperlink should be $repo_root/b/a. + let mut config = integration_test_utils::make_config_from_args(&[ + "--hyperlinks", + "--hyperlinks-file-link-format", + "{path}", + ]); + config.cwd_of_user_shell_process = Some(PathBuf::from("/some/repo-root/b")); + assert_file_hyperlink_matches("a", "/some/repo-root/b/a", &config) + } } } |