diff --git a/crates/xcl/src/config.rs b/crates/xcl/src/config.rs index 3fbeff2a4c..22a7b89748 100644 --- a/crates/xcl/src/config.rs +++ b/crates/xcl/src/config.rs @@ -233,8 +233,9 @@ impl Config { } } + /// `device_type` names the Series S in any spelling `XCL_DEVICE_TYPE` takes ([`parse_device_type`]). pub fn is_series_s(&self) -> bool { - self.device_type.eq_ignore_ascii_case("lockhart") || self.device_type.eq_ignore_ascii_case("series s") + parse_device_type(&self.device_type) == Some("lockhart") } /// Normalize and apply a `XCL_DEVICE_TYPE` override ("anaconda"/"series x"/"xsx"/"x" or @@ -360,11 +361,17 @@ mod tests { lockhart_memory: Some("Advanced".into()), ..Default::default() }; - for device in ["lockhart", "Series S"] { + // the spellings XCL_DEVICE_TYPE takes, in xcl.toml too + for device in ["lockhart", "Series S", "series_s", "xss", "S", " lockhart "] { let mut c = Config { device_type: device.into(), ..Config::default() }; c.resolve(Some(&manifest)); assert_eq!((c.title_memory.as_str(), c.title_memory_mb), ("advanced", 8_192), "{device}"); } + for device in ["anaconda", "Series X", "xsx", "x"] { + let mut c = Config { device_type: device.into(), ..Config::default() }; + c.resolve(Some(&manifest)); + assert_eq!((c.title_memory.as_str(), c.title_memory_mb), ("standard", 13_824), "{device}"); + } let mut c = Config::default(); c.resolve(Some(&manifest)); assert_eq!((c.title_memory.as_str(), c.title_memory_mb), ("standard", 13_824));