Skip to content

Commit fc8e5f8

Browse files
committed
Compile the new tests on all platforms
Since the code under test is currently compiled on all platforms. The current tests' assertions are not guaranteed to hold outside of Windows systems. (It would be unusual to call the functions they are testing outside of Windows. Those functions are themselves mainly not marked to be conditionally compiled so that their callers uses techniques like `if cfg!(windows)` that aren't technically conditional compilation. Those techniques are themselves valuable because they can sometimes be simpler or more readable than conditional compilation or easier to avoid false-positive diagnostics, and because they allow type checking to occur even when building on other platforms, while still usually being fast because "runtime" conditions that are `false` constants still facilitate removal of dead code as an optimization.) So the tests of those functions are likewise built on all targets, but marked conditonally ignored on non-Windows platforms.
1 parent 5e1606b commit fc8e5f8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gix-path/src/env/auxiliary.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub(super) fn find_git_associated_windows_executable_with_fallback(stem: &str) -
114114
})
115115
}
116116

117-
#[cfg(all(windows, test))]
117+
#[cfg(test)]
118118
mod tests {
119119
use std::path::Path;
120120

@@ -139,6 +139,7 @@ mod tests {
139139
];
140140

141141
#[test]
142+
#[cfg_attr(not(windows), ignore)]
142143
fn find_git_associated_windows_executable() {
143144
for stem in SHOULD_FIND {
144145
let path = super::find_git_associated_windows_executable(stem);
@@ -147,6 +148,7 @@ mod tests {
147148
}
148149

149150
#[test]
151+
#[cfg_attr(not(windows), ignore)]
150152
fn find_git_associated_windows_executable_no_extra() {
151153
for stem in SHOULD_NOT_FIND {
152154
let path = super::find_git_associated_windows_executable(stem);
@@ -155,6 +157,7 @@ mod tests {
155157
}
156158

157159
#[test]
160+
#[cfg_attr(not(windows), ignore)]
158161
fn find_git_associated_windows_executable_with_fallback() {
159162
for stem in SHOULD_FIND {
160163
let path = super::find_git_associated_windows_executable_with_fallback(stem);
@@ -163,6 +166,7 @@ mod tests {
163166
}
164167

165168
#[test]
169+
#[cfg_attr(not(windows), ignore)]
166170
fn find_git_associated_windows_executable_with_fallback_falls_back() {
167171
for stem in SHOULD_NOT_FIND {
168172
let path = super::find_git_associated_windows_executable_with_fallback(stem)

0 commit comments

Comments
 (0)