Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sokorototo committed May 22, 2024
1 parent dd5b2d6 commit d8b6a8f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion vach/src/global/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 1 addition & 9 deletions vach/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

Expand Down Expand Up @@ -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)?;

Expand Down
4 changes: 2 additions & 2 deletions vach/src/writer/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Binary file modified vach/test_data/simple/target.vach
Binary file not shown.

0 comments on commit d8b6a8f

Please sign in to comment.