From d3404a70ea754e7b2fc6ae9f5317685a225a850d Mon Sep 17 00:00:00 2001 From: Ruben Arts Date: Fri, 20 Dec 2024 14:21:43 +0100 Subject: [PATCH] test: use snapshots --- ...em_requirements__tests__serialization.snap | 10 +++++++ ...ts__tests__serialization_other_family.snap | 13 +++++++++ .../pixi_manifest/src/system_requirements.rs | 28 ++----------------- 3 files changed, 25 insertions(+), 26 deletions(-) create mode 100644 crates/pixi_manifest/src/snapshots/pixi_manifest__system_requirements__tests__serialization.snap create mode 100644 crates/pixi_manifest/src/snapshots/pixi_manifest__system_requirements__tests__serialization_other_family.snap diff --git a/crates/pixi_manifest/src/snapshots/pixi_manifest__system_requirements__tests__serialization.snap b/crates/pixi_manifest/src/snapshots/pixi_manifest__system_requirements__tests__serialization.snap new file mode 100644 index 000000000..ad72095c6 --- /dev/null +++ b/crates/pixi_manifest/src/snapshots/pixi_manifest__system_requirements__tests__serialization.snap @@ -0,0 +1,10 @@ +--- +source: crates/pixi_manifest/src/system_requirements.rs +expression: serialized +snapshot_kind: text +--- +macos = "10.15" +linux = "5.11" +cuda = "12.2" +libc = "2.12" +archspec = "x86_64" diff --git a/crates/pixi_manifest/src/snapshots/pixi_manifest__system_requirements__tests__serialization_other_family.snap b/crates/pixi_manifest/src/snapshots/pixi_manifest__system_requirements__tests__serialization_other_family.snap new file mode 100644 index 000000000..234b0ce2b --- /dev/null +++ b/crates/pixi_manifest/src/snapshots/pixi_manifest__system_requirements__tests__serialization_other_family.snap @@ -0,0 +1,13 @@ +--- +source: crates/pixi_manifest/src/system_requirements.rs +expression: serialized +snapshot_kind: text +--- +macos = "10.15" +linux = "5.11" +cuda = "12.2" +archspec = "x86_64" + +[libc] +family = "glibc" +version = "2.12" diff --git a/crates/pixi_manifest/src/system_requirements.rs b/crates/pixi_manifest/src/system_requirements.rs index ec2a65209..d345893d8 100644 --- a/crates/pixi_manifest/src/system_requirements.rs +++ b/crates/pixi_manifest/src/system_requirements.rs @@ -522,18 +522,7 @@ mod tests { }; let serialized = to_string_pretty(&system_requirements).unwrap(); - - let expected = r#" - macos = "10.15" - linux = "5.11" - cuda = "12.2" - libc = "2.12" - archspec = "x86_64" - "#; - assert_eq!( - serialized.replace("\n", "").replace(" ", ""), - expected.replace("\n", "").replace(" ", "") - ); + assert_snapshot!(serialized); } #[test] @@ -550,19 +539,6 @@ mod tests { }; let serialized = to_string_pretty(&system_requirements).unwrap(); - let expected = r#" - macos = "10.15" - linux = "5.11" - cuda = "12.2" - archspec = "x86_64" - - [libc] - family = "glibc" - version = "2.12" - "#; - assert_eq!( - serialized.replace("\n", "").replace(" ", ""), - expected.replace("\n", "").replace(" ", "") - ); + assert_snapshot!(serialized); } }