Skip to content

Commit a67b29c

Browse files
committed
Add tests for init and regex match
1 parent ccc8277 commit a67b29c

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

src/cleanup_modules/device_cleanup.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,21 @@ fn is_of_interest(device: &Device) -> bool {
224224

225225
candidate_iter(strings)
226226
}
227+
228+
#[tokio::test]
229+
async fn test_init() {
230+
let mut module = DeviceCleanupModule::new();
231+
let state = State {
232+
dry_run: true,
233+
interactive: false,
234+
use_cache: true,
235+
allow_updates: false,
236+
current_path: Default::default(),
237+
};
238+
module.initialize(&state).await.unwrap();
239+
module.get_objects_to_uninstall().iter().for_each(|d| {
240+
regex_cache::cached_match(Some(""), d.device_desc.as_deref());
241+
regex_cache::cached_match(Some(""), d.manufacturer.as_deref());
242+
regex_cache::cached_match(Some(""), d.hardware_id.as_deref());
243+
});
244+
}

src/cleanup_modules/driver_cleanup.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,20 @@ fn is_of_interest(driver: &Driver) -> bool {
186186
let strings = [driver.inf_original_name(), driver.provider()];
187187
candidate_iter(strings.into_iter().flatten())
188188
}
189+
190+
#[tokio::test]
191+
async fn test_init() {
192+
let mut module = DriverCleanupModule::new();
193+
let state = State {
194+
dry_run: true,
195+
interactive: false,
196+
use_cache: true,
197+
allow_updates: false,
198+
current_path: Default::default(),
199+
};
200+
module.initialize(&state).await.unwrap();
201+
module.get_objects_to_uninstall().iter().for_each(|d| {
202+
regex_cache::cached_match(Some(""), d.original_name.as_deref());
203+
regex_cache::cached_match(Some(""), d.provider.as_deref());
204+
});
205+
}

src/cleanup_modules/driver_package_cleanup.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,3 +412,21 @@ fn to_command(command: &str) -> std::process::Command {
412412

413413
command
414414
}
415+
416+
#[tokio::test]
417+
async fn test_init() {
418+
let mut module = DriverPackageCleanupModule::new();
419+
let state = State {
420+
dry_run: true,
421+
interactive: false,
422+
use_cache: true,
423+
allow_updates: false,
424+
current_path: Default::default(),
425+
};
426+
module.initialize(&state).await.unwrap();
427+
module.get_objects_to_uninstall().iter().for_each(|d| {
428+
regex_cache::cached_match(Some(""), d.display_name.as_deref());
429+
regex_cache::cached_match(Some(""), d.display_version.as_deref());
430+
regex_cache::cached_match(Some(""), d.publisher.as_deref());
431+
});
432+
}

0 commit comments

Comments
 (0)