Implement ostree::checksum_file_at

This commit is contained in:
Felix Krull authored and Colin Walters committed 2022-05-06 12:53:54 -04:00
1 parent 815b8563d5
commit ad26abaa7e
3 files changed
+75 -9

No files matched your search

@@ -0,0 +1,27 @@
use gio::NONE_CANCELLABLE;
use ostree::{checksum_file_at, ChecksumFlags, ObjectType, RepoMode};
use std::path::PathBuf;
use util::TestRepo;
#[test]
fn should_checksum_file_at() {
let repo = TestRepo::new_with_mode(RepoMode::BareUser);
repo.test_commit("test");
let result = checksum_file_at(
repo.repo.get_dfd(),
&PathBuf::from(
"objects/89/f84ca9854a80e85b583e46a115ba4985254437027bad34f0b113219323d3f8.file",
),
None,
ObjectType::File,
ChecksumFlags::IGNORE_XATTRS,
NONE_CANCELLABLE,
)
.expect("checksum file at");
assert_eq!(
result.as_str(),
"89f84ca9854a80e85b583e46a115ba4985254437027bad34f0b113219323d3f8",
);
}
+6 -2
View File
@@ -1,8 +1,12 @@
use gio::NONE_CANCELLABLE;
use glib::Cast;
use ostree::{checksum_file, checksum_file_from_input, ObjectType, RepoFile, RepoFileExt};
use glib::prelude::*;
use ostree::prelude::*;
use ostree::{checksum_file, checksum_file_from_input, ObjectType, RepoFile};
use util::TestRepo;
#[cfg(feature = "v2017_13")]
mod checksum_file_at;
#[test]
fn should_checksum_file() {
let repo = TestRepo::new();