Skip to content

Commit

Permalink
fix: snapshot compatible with windows and linux
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotonQuantum committed Jul 4, 2023
1 parent 99d3883 commit 77371d6
Show file tree
Hide file tree
Showing 52 changed files with 35 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/python_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ fn version(input: &str) -> IResult<&str, Version> {

#[cfg(test)]
mod tests {
use itertools::Itertools;
use rstest::rstest;

use super::Version;
Expand Down Expand Up @@ -254,11 +255,19 @@ mod tests {
#[case("1.0.15")]
#[case("1.1.dev1")]
fn test_parse(#[case] input: &str) {
insta::with_settings!({
snapshot_suffix => input,
}, {
insta::assert_debug_snapshot!(Version::parse(input));
});
let case_name = input
.chars()
.map(|c| {
if c.is_uppercase() {
format!("^{}", c.to_lowercase())
} else {
c.to_string()
}
})
.join("")
.replace('\t', ">t")
.replace('\n', ">n");
insta::assert_debug_snapshot!(case_name, Version::parse(input));
}

#[rstest]
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions src/snapshots/mirror_clone__python_version__tests__1.1rc1.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
source: src/python_version.rs
expression: "Version::parse(input)"
---
Ok(
Version {
epoch: 0,
chunks: [
1,
1,
],
pre: Some(
RC(
1,
),
),
post: None,
dev: None,
local: None,
},
)

0 comments on commit 77371d6

Please sign in to comment.