Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Upgrade to snapbox 0.6 #68

Merged
merged 3 commits into from
May 28, 2024
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
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ shlex = "1.1.0"
git-fixture = { version = "0.3.4", features = ["yaml"] }
assert_fs = "1.1.1"
eyre = "0.6.12"
snapbox = "0.5.9"
snapbox = "0.6.0"
regex = "1.10.4"
divan = "0.1.14"
automod = "1.0.14"
Expand Down
64 changes: 43 additions & 21 deletions src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ pub fn filter_tree<'r>(

#[cfg(test)]
mod tests {
use snapbox::assert_data_eq;
use snapbox::prelude::*;
use snapbox::str;

use super::*;

use crate::testing::make_git;
Expand Down Expand Up @@ -356,13 +360,15 @@ mod tests {
let head_commit = repo.find_commit(head_oid)?;
let head_tree = head_commit.tree()?;

snapbox::assert_eq(
r#""bar" 778e23a1e80b1feb10e00b15b29a33315929c5b5
assert_data_eq!(
dump_tree_entries(&head_tree),
str![[r#"
"bar" 778e23a1e80b1feb10e00b15b29a33315929c5b5
"foo.txt" 19102815663d23f8b75a47e7a01965dcdc96468c
"initial.txt" 63af22885f8665a312ba8b83db722134f1f8290d
"xyzzy.txt" 7c465afc533f95ff7d2c91e18921f94aac8292fc
"#,
dump_tree_entries(&head_tree),

"#]]
);

{
Expand All @@ -383,13 +389,15 @@ mod tests {
})?;
repo.find_tree(hydrated_tree_oid)?
};
snapbox::assert_eq(
r#""bar" 778e23a1e80b1feb10e00b15b29a33315929c5b5
assert_data_eq!(
dump_tree_entries(&hydrated_tree),
str![[r#"
"bar" 778e23a1e80b1feb10e00b15b29a33315929c5b5
"foo-copy.txt" 19102815663d23f8b75a47e7a01965dcdc96468c
"initial.txt" 63af22885f8665a312ba8b83db722134f1f8290d
"xyzzy.txt" 7c465afc533f95ff7d2c91e18921f94aac8292fc
"#,
dump_tree_entries(&hydrated_tree),

"#]]
);
}

Expand All @@ -402,13 +410,15 @@ mod tests {
})?;
repo.find_tree(hydrated_tree_oid)?
};
snapbox::assert_eq(
r#""bar" 08ee88e1c53fbd01ab76f136a4f2c9d759b981d0
assert_data_eq!(
dump_tree_entries(&hydrated_tree),
str![[r#"
"bar" 08ee88e1c53fbd01ab76f136a4f2c9d759b981d0
"foo.txt" 19102815663d23f8b75a47e7a01965dcdc96468c
"initial.txt" 63af22885f8665a312ba8b83db722134f1f8290d
"xyzzy.txt" 7c465afc533f95ff7d2c91e18921f94aac8292fc
"#,
dump_tree_entries(&hydrated_tree),

"#]]
);
}

Expand All @@ -422,12 +432,14 @@ mod tests {
})?;
repo.find_tree(hydrated_tree_oid)?
};
snapbox::assert_eq(
r#""foo.txt" 19102815663d23f8b75a47e7a01965dcdc96468c
assert_data_eq!(
dump_tree_entries(&hydrated_tree),
str![[r#"
"foo.txt" 19102815663d23f8b75a47e7a01965dcdc96468c
"initial.txt" 63af22885f8665a312ba8b83db722134f1f8290d
"xyzzy.txt" 7c465afc533f95ff7d2c91e18921f94aac8292fc
"#,
dump_tree_entries(&hydrated_tree),

"#]]
);
}

Expand All @@ -441,11 +453,13 @@ mod tests {
],
)?;
let dehydrated_tree = repo.find_tree(dehydrated_tree_oid)?;
snapbox::assert_eq(
r#""bar" 08ee88e1c53fbd01ab76f136a4f2c9d759b981d0
"foo.txt" 19102815663d23f8b75a47e7a01965dcdc96468c
"#,
assert_data_eq!(
dump_tree_entries(&dehydrated_tree),
str![[r#"
"bar" 08ee88e1c53fbd01ab76f136a4f2c9d759b981d0
"foo.txt" 19102815663d23f8b75a47e7a01965dcdc96468c

"#]]
);
}

Expand Down Expand Up @@ -475,7 +489,15 @@ mod tests {
.collect::<Vec<_>>();
changed_paths.sort();

snapbox::assert_eq(r#"["initial.txt"]"#, format!("{:?}", changed_paths));
assert_data_eq!(
changed_paths.to_debug(),
str![[r#"
[
"initial.txt",
]

"#]]
);

Ok(())
}
Expand Down
Loading