Skip to content

Commit 43edaf3

Browse files
committed
move test to module
1 parent 71db81a commit 43edaf3

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/utils.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,24 @@ pub(crate) fn improve_remove_error(error: std::io::Error, path: &Path) -> std::i
7777
)
7878
}
7979

80-
#[test]
81-
fn custom_remove_error() {
82-
let path = "test/path".as_ref();
83-
84-
let expected = "failed to remove 'test/path' : PermissionDenied";
85-
let tested = format!(
86-
"{}",
87-
improve_remove_error(
88-
std::io::Error::from(std::io::ErrorKind::PermissionDenied),
89-
path
90-
)
91-
);
92-
assert_eq!(expected, tested);
80+
#[cfg(test)]
81+
mod tests {
82+
use super::*;
83+
84+
#[test]
85+
fn custom_remove_error() {
86+
let path = "test/path".as_ref();
87+
88+
let expected = "failed to remove 'test/path' : PermissionDenied";
89+
let tested = format!(
90+
"{}",
91+
improve_remove_error(
92+
std::io::Error::from(std::io::ErrorKind::PermissionDenied),
93+
path
94+
)
95+
);
96+
assert_eq!(expected, tested);
97+
}
9398
}
9499

95100
pub(crate) fn normalize_path(path: &Path) -> PathBuf {

0 commit comments

Comments
 (0)