Skip to content

Commit e764cde

Browse files
committed
fix(dir): Rename path to dir
1 parent 877c0b1 commit e764cde

File tree

10 files changed

+25
-25
lines changed

10 files changed

+25
-25
lines changed

crates/snapbox/src/assert/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl Assert {
220220
}
221221

222222
let checks: Vec<_> =
223-
crate::path::PathDiff::subset_eq_iter_inner(expected_root, actual_root).collect();
223+
crate::dir::PathDiff::subset_eq_iter_inner(expected_root, actual_root).collect();
224224
self.verify(checks);
225225
}
226226

@@ -248,7 +248,7 @@ impl Assert {
248248
Action::Ignore | Action::Verify | Action::Overwrite => {}
249249
}
250250

251-
let checks: Vec<_> = crate::path::PathDiff::subset_matches_iter_inner(
251+
let checks: Vec<_> = crate::dir::PathDiff::subset_matches_iter_inner(
252252
expected_root,
253253
actual_root,
254254
&self.substitutions,
@@ -261,7 +261,7 @@ impl Assert {
261261
#[track_caller]
262262
fn verify(
263263
&self,
264-
mut checks: Vec<Result<(std::path::PathBuf, std::path::PathBuf), crate::path::PathDiff>>,
264+
mut checks: Vec<Result<(std::path::PathBuf, std::path::PathBuf), crate::dir::PathDiff>>,
265265
) {
266266
if checks.iter().all(Result::is_ok) {
267267
for check in checks {

crates/snapbox/src/data/source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl From<Inline> for DataSource {
6363
impl std::fmt::Display for DataSource {
6464
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6565
match &self.inner {
66-
DataSourceInner::Path(value) => crate::path::display_relpath(value).fmt(f),
66+
DataSourceInner::Path(value) => crate::dir::display_relpath(value).fmt(f),
6767
DataSourceInner::Inline(value) => value.fmt(f),
6868
}
6969
}

crates/snapbox/src/path/diff.rs renamed to crates/snapbox/src/dir/diff.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl PathDiff {
4343
expected_root: std::path::PathBuf,
4444
actual_root: std::path::PathBuf,
4545
) -> impl Iterator<Item = Result<(std::path::PathBuf, std::path::PathBuf), Self>> {
46-
let walker = crate::path::Walk::new(&expected_root);
46+
let walker = crate::dir::Walk::new(&expected_root);
4747
walker.map(move |r| {
4848
let expected_path = r.map_err(|e| Self::Failure(e.to_string().into()))?;
4949
let rel = expected_path.strip_prefix(&expected_root).unwrap();
@@ -119,7 +119,7 @@ impl PathDiff {
119119
substitutions: &crate::Redactions,
120120
normalize_paths: bool,
121121
) -> impl Iterator<Item = Result<(std::path::PathBuf, std::path::PathBuf), Self>> + '_ {
122-
let walker = crate::path::Walk::new(&expected_root);
122+
let walker = crate::dir::Walk::new(&expected_root);
123123
walker.map(move |r| {
124124
let expected_path = r.map_err(|e| Self::Failure(e.to_string().into()))?;
125125
let rel = expected_path.strip_prefix(&expected_root).unwrap();

crates/snapbox/src/path/fixture.rs renamed to crates/snapbox/src/dir/fixture.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl PathFixture {
2929
let temp = tempfile::tempdir().map_err(|e| e.to_string())?;
3030
// We need to get the `/private` prefix on Mac so variable substitutions work
3131
// correctly
32-
let path = crate::path::canonicalize(temp.path())
32+
let path = crate::dir::canonicalize(temp.path())
3333
.map_err(|e| format!("Failed to canonicalize {}: {}", temp.path().display(), e))?;
3434
Ok(Self(PathFixtureInner::MutableTemp { temp, path }))
3535
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

crates/snapbox/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
//! [`Output`][std::process::Output].
3535
//!
3636
//! Testing Filesystem Interactions:
37-
//! - [`path::PathFixture`]: Working directory for tests
37+
//! - [`dir::PathFixture`]: Working directory for tests
3838
//! - [`Assert`]: Diff a directory against files present in a pattern directory
3939
//!
4040
//! You can also build your own version of these with the lower-level building blocks these are
@@ -66,8 +66,8 @@ mod macros;
6666
pub mod assert;
6767
pub mod cmd;
6868
pub mod data;
69+
pub mod dir;
6970
pub mod filters;
70-
pub mod path;
7171
pub mod report;
7272
pub mod utils;
7373

crates/trycmd/src/runner.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use std::io::stderr;
1313

1414
use rayon::prelude::*;
1515
use snapbox::data::DataFormat;
16+
use snapbox::dir::FileType;
1617
use snapbox::filters::{Filter as _, FilterNewlines, FilterPaths, FilterRedactions};
17-
use snapbox::path::FileType;
1818
use snapbox::IntoData;
1919

2020
#[derive(Debug)]
@@ -188,7 +188,7 @@ impl Case {
188188
.map(|p| {
189189
sequence.fs.rel_cwd().map(|rel| {
190190
let p = p.join(rel);
191-
snapbox::path::strip_trailing_slash(&p).to_owned()
191+
snapbox::dir::strip_trailing_slash(&p).to_owned()
192192
})
193193
})
194194
.transpose()
@@ -504,7 +504,7 @@ impl Case {
504504
} else {
505505
let fixture_root = self.path.with_extension("out");
506506
if fixture_root.exists() {
507-
for status in snapbox::path::PathDiff::subset_matches_iter(
507+
for status in snapbox::dir::PathDiff::subset_matches_iter(
508508
fixture_root,
509509
actual_root,
510510
substitutions,
@@ -878,11 +878,11 @@ impl FileStatus {
878878
}
879879
}
880880

881-
impl From<snapbox::path::PathDiff> for FileStatus {
882-
fn from(other: snapbox::path::PathDiff) -> Self {
881+
impl From<snapbox::dir::PathDiff> for FileStatus {
882+
fn from(other: snapbox::dir::PathDiff) -> Self {
883883
match other {
884-
snapbox::path::PathDiff::Failure(err) => FileStatus::Failure(err),
885-
snapbox::path::PathDiff::TypeMismatch {
884+
snapbox::dir::PathDiff::Failure(err) => FileStatus::Failure(err),
885+
snapbox::dir::PathDiff::TypeMismatch {
886886
expected_path,
887887
actual_path,
888888
expected_type,
@@ -893,7 +893,7 @@ impl From<snapbox::path::PathDiff> for FileStatus {
893893
actual_type,
894894
expected_type,
895895
},
896-
snapbox::path::PathDiff::LinkMismatch {
896+
snapbox::dir::PathDiff::LinkMismatch {
897897
expected_path,
898898
actual_path,
899899
expected_target,
@@ -904,7 +904,7 @@ impl From<snapbox::path::PathDiff> for FileStatus {
904904
actual_target,
905905
expected_target,
906906
},
907-
snapbox::path::PathDiff::ContentMismatch {
907+
snapbox::dir::PathDiff::ContentMismatch {
908908
expected_path,
909909
actual_path,
910910
expected_content,
@@ -1016,20 +1016,20 @@ fn fs_context(
10161016
cwd: Option<&std::path::Path>,
10171017
sandbox: bool,
10181018
mode: &crate::Mode,
1019-
) -> Result<snapbox::path::PathFixture, crate::Error> {
1019+
) -> Result<snapbox::dir::PathFixture, crate::Error> {
10201020
if sandbox {
10211021
#[cfg(feature = "filesystem")]
10221022
match mode {
10231023
crate::Mode::Dump(root) => {
10241024
let target = root.join(path.with_extension("out").file_name().unwrap());
1025-
let mut context = snapbox::path::PathFixture::mutable_at(&target)?;
1025+
let mut context = snapbox::dir::PathFixture::mutable_at(&target)?;
10261026
if let Some(cwd) = cwd {
10271027
context = context.with_template(cwd)?;
10281028
}
10291029
Ok(context)
10301030
}
10311031
crate::Mode::Fail | crate::Mode::Overwrite => {
1032-
let mut context = snapbox::path::PathFixture::mutable_temp()?;
1032+
let mut context = snapbox::dir::PathFixture::mutable_temp()?;
10331033
if let Some(cwd) = cwd {
10341034
context = context.with_template(cwd)?;
10351035
}
@@ -1040,7 +1040,7 @@ fn fs_context(
10401040
Err("Sandboxing is disabled".into())
10411041
} else {
10421042
Ok(cwd
1043-
.map(snapbox::path::PathFixture::immutable)
1044-
.unwrap_or_else(snapbox::path::PathFixture::none))
1043+
.map(snapbox::dir::PathFixture::immutable)
1044+
.unwrap_or_else(snapbox::dir::PathFixture::none))
10451045
}
10461046
}

crates/trycmd/src/schema.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ impl TryCmd {
109109
.fs
110110
.base
111111
.take()
112-
.map(|p| snapbox::path::resolve_dir(p).map_err(|e| e.to_string()))
112+
.map(|p| snapbox::dir::resolve_dir(p).map_err(|e| e.to_string()))
113113
.transpose()?;
114114
sequence.fs.cwd = sequence
115115
.fs
116116
.cwd
117117
.take()
118-
.map(|p| snapbox::path::resolve_dir(p).map_err(|e| e.to_string()))
118+
.map(|p| snapbox::dir::resolve_dir(p).map_err(|e| e.to_string()))
119119
.transpose()?;
120120

121121
Ok(sequence)

0 commit comments

Comments
 (0)