From d8b6a8fe680af0f4fd804457f527a0bb3af96bea Mon Sep 17 00:00:00 2001 From: sokorototo Date: Wed, 22 May 2024 13:08:22 +0300 Subject: [PATCH] fixed tests --- .gitignore | 6 +++--- vach/src/global/flags.rs | 2 +- vach/src/tests.rs | 10 +--------- vach/src/writer/config.rs | 4 ++-- vach/test_data/simple/target.vach | Bin 190433 -> 190433 bytes 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index c75ae134..753bc0f1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,6 @@ workspace.code-workspace .cargo/config.toml # Test Data -vach/test_data/encrypted -vach/test_data/signed -vach/test_data/simple +vach/test_data/encrypted/target.vach +vach/test_data/signed/target.vach +vach/test_data/simple/target.vach diff --git a/vach/src/global/flags.rs b/vach/src/global/flags.rs index 0646091d..45f43b64 100644 --- a/vach/src/global/flags.rs +++ b/vach/src/global/flags.rs @@ -3,7 +3,7 @@ use super::error::*; /// Abstracted flag access and manipulation `struct`. /// A knock-off minimal [bitflags](https://crates.io/crates/bitflags) of sorts. -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord)] #[repr(transparent)] pub struct Flags { pub(crate) bits: u32, diff --git a/vach/src/tests.rs b/vach/src/tests.rs index bb482ed5..3766b961 100644 --- a/vach/src/tests.rs +++ b/vach/src/tests.rs @@ -26,16 +26,12 @@ fn custom_bitflags() -> InternalResult { let target = File::open(SIMPLE_TARGET)?; let archive = Archive::new(target)?; - dbg!(archive.entries()); - let entry = archive.fetch_entry("poem").unwrap(); let flags = entry.flags; assert_eq!(flags.bits(), entry.flags.bits()); assert!(flags.contains(CUSTOM_FLAG_1 | CUSTOM_FLAG_2 | CUSTOM_FLAG_3 | CUSTOM_FLAG_4)); - dbg!(flags); - Ok(()) } @@ -131,11 +127,7 @@ fn fetch_no_signature() -> InternalResult { fn builder_with_signature() -> InternalResult { let mut builder = Builder::default(); - let cb = |entry: &RegistryEntry| { - dbg!(entry); - }; - let mut build_config = BuilderConfig::default().callback(&cb); - + let mut build_config = BuilderConfig::default(); build_config.load_keypair(KEYPAIR.as_slice())?; builder.add_dir("test_data", None)?; diff --git a/vach/src/writer/config.rs b/vach/src/writer/config.rs index ad04a7a7..9317f72d 100644 --- a/vach/src/writer/config.rs +++ b/vach/src/writer/config.rs @@ -27,8 +27,8 @@ pub struct BuilderConfig<'a> { /// use vach::prelude::{RegistryEntry, BuilderConfig, Leaf}; /// /// let builder_config = BuilderConfig::default(); - /// fn callback(leaf: &Leaf, reg_entry: &RegistryEntry) { - /// println!("Leaf: {leaf:?} has been processed into Entry: {reg_entry:?}") + /// fn callback(reg_entry: &RegistryEntry) { + /// println!("Processed Entry: {:?}", reg_entry) /// } /// /// builder_config.callback(&callback); diff --git a/vach/test_data/simple/target.vach b/vach/test_data/simple/target.vach index 59b88b540ea61bcd96e52eda1b43bff65e996979..749e4905b5daca076778f7c17329d7d5401840f2 100644 GIT binary patch delta 218 zcmaEOp8Mf>?)tDaM`sTPAdq8V15peN+aMIfPId@`g`qebamtYEDkRj)HSyadBc^N>QRB E0JGF7<^TWy delta 202 zcmaEOp8Mf>Zl16-M`sTPAdq8Vn?BK#QDpi8Pe#^3M+kbP=H%q-C^#n;7boVW6eTJ) OZfo7fxOE$o)N=q-nm