Skip to content

Commit

Permalink
Merge pull request #297 from epage/path
Browse files Browse the repository at this point in the history
fix(snap)!: Move `path` to `dir`
  • Loading branch information
epage authored Apr 23, 2024
2 parents dff9cba + e764cde commit 253fd33
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 372 deletions.
6 changes: 3 additions & 3 deletions crates/snapbox/src/assert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl Assert {
}

let checks: Vec<_> =
crate::path::PathDiff::subset_eq_iter_inner(expected_root, actual_root).collect();
crate::dir::PathDiff::subset_eq_iter_inner(expected_root, actual_root).collect();
self.verify(checks);
}

Expand Down Expand Up @@ -248,7 +248,7 @@ impl Assert {
Action::Ignore | Action::Verify | Action::Overwrite => {}
}

let checks: Vec<_> = crate::path::PathDiff::subset_matches_iter_inner(
let checks: Vec<_> = crate::dir::PathDiff::subset_matches_iter_inner(
expected_root,
actual_root,
&self.substitutions,
Expand All @@ -261,7 +261,7 @@ impl Assert {
#[track_caller]
fn verify(
&self,
mut checks: Vec<Result<(std::path::PathBuf, std::path::PathBuf), crate::path::PathDiff>>,
mut checks: Vec<Result<(std::path::PathBuf, std::path::PathBuf), crate::dir::PathDiff>>,
) {
if checks.iter().all(Result::is_ok) {
for check in checks {
Expand Down
6 changes: 3 additions & 3 deletions crates/snapbox/src/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ macro_rules! file {
$crate::Data::read_from(&path, Some($crate::data::DataFormat:: $type))
}};
[$path:literal] => {{
let mut path = $crate::current_dir!();
let mut path = $crate::utils::current_dir!();
path.push($path);
$crate::Data::read_from(&path, None)
}};
[$path:literal : $type:ident] => {{
let mut path = $crate::current_dir!();
let mut path = $crate::utils::current_dir!();
path.push($path);
$crate::Data::read_from(&path, Some($crate::data::DataFormat:: $type))
}};
Expand All @@ -201,7 +201,7 @@ macro_rules! str {
[$data:literal] => { $crate::str![[$data]] };
[[$data:literal]] => {{
let position = $crate::data::Position {
file: $crate::path::current_rs!(),
file: $crate::utils::current_rs!(),
line: line!(),
column: column!(),
};
Expand Down
2 changes: 1 addition & 1 deletion crates/snapbox/src/data/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl From<Inline> for DataSource {
impl std::fmt::Display for DataSource {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &self.inner {
DataSourceInner::Path(value) => crate::path::display_relpath(value).fmt(f),
DataSourceInner::Path(value) => crate::dir::display_relpath(value).fmt(f),
DataSourceInner::Inline(value) => value.fmt(f),
}
}
Expand Down
Loading

0 comments on commit 253fd33

Please sign in to comment.