mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-11-16 07:48:11 +01:00
Use assert_matches
This commit is contained in:
parent
53ea4ebace
commit
353d345e90
4 changed files with 271 additions and 262 deletions
500
Cargo.lock
generated
500
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -116,7 +116,6 @@ x11rb = { version = "0.13.1", default-features = false, features = ["composite"]
|
|||
xkbcommon = { workspace = true }
|
||||
xdg = { workspace = true }
|
||||
sysinfo = "0.30.12"
|
||||
# nix = { version = "0.28.0", features = ["user", "resource", "process", "signal"] }
|
||||
pinnacle-api-defs = { workspace = true }
|
||||
dircpy = { workspace = true }
|
||||
chrono = "0.4.38"
|
||||
|
@ -128,6 +127,7 @@ libdisplay-info-sys = { git = "https://github.com/Smithay/libdisplay-info-rs", r
|
|||
indexmap = { workspace = true }
|
||||
snowcap = { path = "./snowcap", optional = true }
|
||||
snowcap-api = { path = "./snowcap/api/rust", optional = true }
|
||||
assert_matches = "1.5.0"
|
||||
|
||||
[build-dependencies]
|
||||
vergen = { version = "8.3.1", features = ["git", "gitcl", "rustc", "cargo", "si"] }
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
mod drm;
|
||||
mod gamma;
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
pub use drm::util::drm_mode_from_api_modeline;
|
||||
use indexmap::IndexSet;
|
||||
|
||||
|
@ -1306,7 +1307,7 @@ impl Udev {
|
|||
return;
|
||||
}
|
||||
|
||||
assert!(matches!(surface.render_state, RenderState::Scheduled(_)));
|
||||
assert_matches!(surface.render_state, RenderState::Scheduled(_));
|
||||
|
||||
let render_node = surface.render_node;
|
||||
let primary_gpu = self.primary_gpu;
|
||||
|
|
28
src/cli.rs
28
src/cli.rs
|
@ -456,6 +456,7 @@ fn generate_config(args: ConfigGen) -> anyhow::Result<()> {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use anyhow::Context;
|
||||
use assert_matches::assert_matches;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
@ -519,18 +520,9 @@ mod tests {
|
|||
|
||||
generate_config(config_gen)?;
|
||||
|
||||
assert!(matches!(
|
||||
temp_dir.join("default_config.lua").try_exists(),
|
||||
Ok(true)
|
||||
));
|
||||
assert!(matches!(
|
||||
temp_dir.join("metaconfig.toml").try_exists(),
|
||||
Ok(true)
|
||||
));
|
||||
assert!(matches!(
|
||||
temp_dir.join(".luarc.json").try_exists(),
|
||||
Ok(true)
|
||||
));
|
||||
assert_matches!(temp_dir.join("default_config.lua").try_exists(), Ok(true));
|
||||
assert_matches!(temp_dir.join("metaconfig.toml").try_exists(), Ok(true));
|
||||
assert_matches!(temp_dir.join(".luarc.json").try_exists(), Ok(true));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -550,15 +542,9 @@ mod tests {
|
|||
|
||||
generate_config(config_gen)?;
|
||||
|
||||
assert!(matches!(
|
||||
temp_dir.join("src/main.rs").try_exists(),
|
||||
Ok(true)
|
||||
));
|
||||
assert!(matches!(
|
||||
temp_dir.join("metaconfig.toml").try_exists(),
|
||||
Ok(true)
|
||||
));
|
||||
assert!(matches!(temp_dir.join("Cargo.toml").try_exists(), Ok(true)));
|
||||
assert_matches!(temp_dir.join("src/main.rs").try_exists(), Ok(true));
|
||||
assert_matches!(temp_dir.join("metaconfig.toml").try_exists(), Ok(true));
|
||||
assert_matches!(temp_dir.join("Cargo.toml").try_exists(), Ok(true));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue