From 478d2b18bdd1e13fcad9495a4e021fd76148b05b Mon Sep 17 00:00:00 2001 From: Cosmic Horror Date: Thu, 7 Dec 2023 19:47:52 -0700 Subject: [PATCH] Conditionally ignore `shortcuts_extras` test --- src/shortcut.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/shortcut.rs b/src/shortcut.rs index b4b606e..69c8340 100644 --- a/src/shortcut.rs +++ b/src/shortcut.rs @@ -252,14 +252,22 @@ mod tests { ); } - #[cfg(feature = "shortcuts_extras")] + #[cfg_attr( + not(feature = "shortcuts_extras"), + ignore = "Needs `shortcuts_extras` feature" + )] #[test] fn shortcuts_extras() { - let contents = include_bytes!("../tests/sample_data/shortcuts.vdf"); - let shortcuts = parse_shortcuts(contents).unwrap(); - let ideal_ids = vec![0xe89614fe02000000, 0xdb01c79902000000, 0x9d55017302000000]; - for (id, shortcut) in ideal_ids.into_iter().zip(shortcuts.iter()) { - assert_eq!(id, shortcut.steam_id()); + #[cfg(not(feature = "shortcuts_extras"))] + unreachable!(); + #[cfg(feature = "shortcuts_extras")] + { + let contents = include_bytes!("../tests/sample_data/shortcuts.vdf"); + let shortcuts = parse_shortcuts(contents).unwrap(); + let ideal_ids = vec![0xe89614fe02000000, 0xdb01c79902000000, 0x9d55017302000000]; + for (id, shortcut) in ideal_ids.into_iter().zip(shortcuts.iter()) { + assert_eq!(id, shortcut.steam_id()); + } } } }