Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.56.1
toolchain: 1.60.0
- name: Test
run: make cargotest

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to insta and cargo-insta are documented here.

## 1.30.0

- Resolved a bug on Windows that caused `input_file` not to be written into the
snapshots. (#386)
- Snapshots are accepted when running with `--accept` even if a test outside
insta fails. (#358)
- Mark settings drop guard as `#[must_use]`.
Expand Down
13 changes: 3 additions & 10 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,9 @@ impl<'a> SnapshotAssertionContext<'a> {

/// Given a path returns the local path within the workspace.
pub fn localize_path(&self, p: &Path) -> Option<PathBuf> {
self.cargo_workspace
.join(p)
.canonicalize()
.ok()
.and_then(|s| {
self.cargo_workspace
.canonicalize()
.ok()
.and_then(|cw| s.strip_prefix(cw).ok().map(|x| x.to_path_buf()))
})
let workspace = self.cargo_workspace.canonicalize().ok()?;
let p = self.cargo_workspace.join(p).canonicalize().ok()?;
p.strip_prefix(&workspace).ok().map(|x| x.to_path_buf())
}

/// Creates the new snapshot from input values.
Expand Down