From fee72b87cf732180889ebc9151b77249533d6995 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 11 Jun 2024 09:10:46 +0300 Subject: niri-config: Add pretty-assertions to tests The config parse test is pretty big and it's impossible to tell the difference from the normal assert. --- Cargo.lock | 17 +++++++++++++++++ niri-config/Cargo.toml | 3 +++ niri-config/src/lib.rs | 2 ++ 3 files changed, 22 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index fbab1723..03c777fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2216,6 +2216,7 @@ dependencies = [ "knuffel", "miette", "niri-ipc", + "pretty_assertions", "regex", "smithay", "tracing", @@ -2682,6 +2683,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "pretty_assertions" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +dependencies = [ + "diff", + "yansi", +] + [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -4375,6 +4386,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d422e8e38ec76e2f06ee439ccc765e9c6a9638b9e7c9f2e8255e4d41e8bd852" +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + [[package]] name = "yansi-term" version = "0.1.2" diff --git a/niri-config/Cargo.toml b/niri-config/Cargo.toml index 89b3acb5..f0067c15 100644 --- a/niri-config/Cargo.toml +++ b/niri-config/Cargo.toml @@ -17,3 +17,6 @@ regex = "1.10.5" smithay = { workspace = true, features = ["backend_libinput"] } tracing.workspace = true tracy-client.workspace = true + +[dev-dependencies] +pretty_assertions = "1.4.0" diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index cbf70e59..4fbb96e1 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -2320,6 +2320,8 @@ pub fn set_miette_hook() -> Result<(), miette::InstallError> { #[cfg(test)] mod tests { + use pretty_assertions::assert_eq; + use super::*; #[track_caller] -- cgit