Skip to content

Commit 5a64cbd

Browse files
committed
test: add core
1 parent 0cd0c46 commit 5a64cbd

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

crates/libs/kill_tree/src/core.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,7 @@ mod tests {
166166
process_id: 0,
167167
reason: "reason".to_string(),
168168
};
169-
assert_eq!(
170-
format!("{}", error),
171-
"Invalid process id: 0. Reason: reason"
172-
);
169+
assert_eq!(format!("{error}"), "Invalid process id: 0. Reason: reason");
173170
}
174171

175172
#[test]
@@ -179,7 +176,7 @@ mod tests {
179176
source: u32::try_from(-1).unwrap_err(),
180177
};
181178
assert_eq!(
182-
format!("{}", error),
179+
format!("{error}"),
183180
"Invalid cast. Reason: reason. Source: out of range integral type conversion attempted"
184181
);
185182
}
@@ -193,23 +190,23 @@ mod tests {
193190
source: Some("source".parse::<u32>().unwrap_err()),
194191
};
195192
assert_eq!(
196-
format!("{}", error),
193+
format!("{error}"),
197194
"Invalid proc entry. Process id: 0. Path: /proc/0. Reason: reason. Source: Some(ParseIntError { kind: InvalidDigit })"
198195
);
199196
}
200197

201198
#[test]
202199
fn error_display_io() {
203200
let error = Error::Io(std::io::Error::new(std::io::ErrorKind::Other, "error"));
204-
assert_eq!(format!("{}", error), "I/O error: error");
201+
assert_eq!(format!("{error}"), "I/O error: error");
205202
}
206203

207204
#[cfg(windows)]
208205
#[test]
209206
fn error_display_windows() {
210207
let error = Error::Windows(windows::core::Error::OK);
211208
assert_eq!(
212-
format!("{}", error),
209+
format!("{error}"),
213210
"Windows error: The operation completed successfully. (0x00000000)"
214211
);
215212
}
@@ -218,14 +215,14 @@ mod tests {
218215
#[test]
219216
fn error_display_unix() {
220217
let error = Error::Unix(nix::Error::UnsupportedOperation);
221-
assert_eq!(format!("{}", error), "Unix error: UnsupportedOperation");
218+
assert_eq!(format!("{error}"), "Unix error: UnsupportedOperation");
222219
}
223220

224221
#[test]
225222
fn from_io_error() {
226223
let error = std::io::Error::new(std::io::ErrorKind::Other, "error");
227224
let error = Error::from(error);
228-
assert_eq!(format!("{}", error), "I/O error: error");
225+
assert_eq!(format!("{error}"), "I/O error: error");
229226
}
230227

231228
#[cfg(windows)]
@@ -234,7 +231,7 @@ mod tests {
234231
let error = windows::core::Error::OK;
235232
let error = Error::from(error);
236233
assert_eq!(
237-
format!("{}", error),
234+
format!("{error}"),
238235
"Windows error: The operation completed successfully. (0x00000000)"
239236
);
240237
}
@@ -244,13 +241,13 @@ mod tests {
244241
fn from_unix_error() {
245242
let error = nix::Error::UnsupportedOperation;
246243
let error = Error::from(error);
247-
assert_eq!(format!("{}", error), "Unix error: UnsupportedOperation");
244+
assert_eq!(format!("{error}"), "Unix error: UnsupportedOperation");
248245
}
249246

250247
#[test]
251248
fn default_config() {
252249
let config = Config::default();
253250
assert_eq!(config.signal, "SIGTERM");
254-
assert_eq!(config.include_target, true);
251+
assert!(config.include_target);
255252
}
256253
}

0 commit comments

Comments
 (0)