From 274126c416a3ffb4596b0f66db962d91e49db4b5 Mon Sep 17 00:00:00 2001 From: Ross Smyth <18294397+RossSmyth@users.noreply.github.com> Date: Wed, 10 Jul 2024 13:17:53 -0400 Subject: [PATCH] Add test for capturing the second part of the serial number --- src/windows/enumerate.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/windows/enumerate.rs b/src/windows/enumerate.rs index 215e6cb0..b6dd6ce7 100644 --- a/src/windows/enumerate.rs +++ b/src/windows/enumerate.rs @@ -543,6 +543,10 @@ pub fn available_ports() -> Result> { #[test] fn test_parsing_usb_port_information() { + let madeup_hwid = r"USB\VID_1D50&PID_6018+6&A694CA9&0&0000"; + let info = parse_usb_port_info(madeup_hwid, None).unwrap(); + assert_eq!(info.serial_number, Some("A694CA9".to_string())); + let bm_uart_hwid = r"USB\VID_1D50&PID_6018&MI_02\6&A694CA9&0&0000"; let bm_parent_hwid = r"USB\VID_1D50&PID_6018\85A12F01"; let info = parse_usb_port_info(bm_uart_hwid, Some(bm_parent_hwid)).unwrap();