Skip to content

Commit

Permalink
update snapshot to ignore PID
Browse files Browse the repository at this point in the history
  • Loading branch information
ntBre committed Nov 30, 2024
1 parent 7dad4b0 commit 7ac849a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ log = "0.4.22"
approx = "0.5.1"
tempfile = "3.14.0"
assert_cmd = "2.0.16"
insta = "1.41.1"
insta = { version = "1.41.1", features = ["filters"] }

[[bin]]
name = "cart"
Expand Down
10 changes: 8 additions & 2 deletions tests/cart.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{fs::read_to_string, path::Path};

use assert_cmd::Command;
use insta::assert_snapshot;
use insta::{assert_snapshot, with_settings};
use tempfile::tempdir;

#[test]
Expand All @@ -20,7 +20,13 @@ fn cart() -> std::io::Result<()> {
read_to_string(dir.path().join("pbqff.log"))?,
);

assert_snapshot!(read_to_string(dir.path().join("pbqff.out"))?);
with_settings!(
{filters => vec![
(r"PID: \d+", "PID: [PID]"),
]}, {
assert_snapshot!(read_to_string(dir.path().join("pbqff.out")).unwrap());
}
);

Ok(())
}
4 changes: 2 additions & 2 deletions tests/snapshots/cart__cart.snap
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
source: tests/cart.rs
expression: "read_to_string(dir.path().join(\"pbqff.out\"))?"
expression: "read_to_string(dir.path().join(\"pbqff.out\")).unwrap()"
snapshot_kind: text
---
PID: 3507331
PID: [PID]
version: deadbeef
normalized geometry:

Expand Down

0 comments on commit 7ac849a

Please sign in to comment.