From a8f8dda06cb97d67e8d2f55f50cf6f9398bdd969 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 9 Apr 2024 23:46:33 +0200 Subject: [PATCH] Add regression test for components --- tests/components.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/components.rs diff --git a/tests/components.rs b/tests/components.rs new file mode 100644 index 000000000..27cadf3e9 --- /dev/null +++ b/tests/components.rs @@ -0,0 +1,17 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +#[test] +fn test_components() { + use std::env::var; + + let mut c = sysinfo::Components::new(); + assert!(c.is_empty()); + + // Unfortunately, we can't get components in the CI... + if !sysinfo::IS_SUPPORTED_SYSTEM || cfg!(windows) || var("CI").is_ok() { + return; + } + + c.refresh_list(); + assert!(!c.is_empty()); +}