Fix CI by downgrading to cargo insta 1.29.0 (#5589)

Since the (implicit) update to cargo-insta 1.30, CI would pass even when
the tests failed. This downgrades to cargo insta 1.29.0 and CI fails
again when it should (which i can't show here, because CI needs to pass
to merge this PR). I've improved the unreferenced snapshot handling in
the process

See https://github.com/mitsuhiko/insta/issues/392
This commit is contained in:
konsti 2023-07-08 16:54:49 +02:00 committed by GitHub
parent efe7c393d1
commit d0dae7e576
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 16 deletions

View file

@ -15,7 +15,6 @@ mod search;
#[cfg(test)]
mod tests {
use insta::assert_debug_snapshot;
use std::fs::{create_dir_all, File};
use std::io::{self, Write};
use std::path::{Path, PathBuf};
@ -129,6 +128,16 @@ mod tests {
env_logger::builder().is_test(true).try_init().ok();
}
macro_rules! assert_debug_snapshot_normalize_paths {
($value: ident) => {{
// The debug representation for the backslash are two backslashes (escaping)
let $value = std::format!("{:#?}", $value).replace("\\\\", "/");
// `insta::assert_snapshot` uses the debug representation of the string, which would
// be a single line containing `\n`
insta::assert_display_snapshot!($value);
}};
}
#[test]
fn partial_stub_file_exists() -> io::Result<()> {
setup();
@ -810,7 +819,7 @@ mod tests {
},
);
assert_debug_snapshot!(result);
assert_debug_snapshot_normalize_paths!(result);
}
#[test]
@ -831,7 +840,7 @@ mod tests {
},
);
assert_debug_snapshot!(result);
assert_debug_snapshot_normalize_paths!(result);
}
#[test]
@ -852,7 +861,7 @@ mod tests {
},
);
assert_debug_snapshot!(result);
assert_debug_snapshot_normalize_paths!(result);
}
#[test]
@ -873,7 +882,7 @@ mod tests {
},
);
assert_debug_snapshot!(result);
assert_debug_snapshot_normalize_paths!(result);
}
#[test]
@ -894,7 +903,7 @@ mod tests {
},
);
assert_debug_snapshot!(result);
assert_debug_snapshot_normalize_paths!(result);
}
#[test]
@ -915,7 +924,7 @@ mod tests {
},
);
assert_debug_snapshot!(result);
assert_debug_snapshot_normalize_paths!(result);
}
#[test]
@ -936,6 +945,6 @@ mod tests {
},
);
assert_debug_snapshot!(result);
assert_debug_snapshot_normalize_paths!(result);
}
}