Skip to content

Commit

Permalink
Add failing test (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Apr 3, 2021
1 parent fb5cea4 commit d629339
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions git-odb/tests/compound/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use crate::{fixture_path, hex_to_id};
use git_odb::compound::Db;

fn db() -> Db {
Db::at(fixture_path("objects")).expect("valid object path")
}

fn can_locate(db: &Db, hex_id: &str) {
let mut buf = vec![];
assert!(db.locate(hex_to_id(hex_id).to_borrowed(), &mut buf).is_some());
}

#[test]
fn loose_object_lookup() {
can_locate(&db(), "37d4e6c5c48ba0d245164c4e10d5f41140cab980");
}

#[test]
#[should_panic]
fn pack_object_lookup() {
can_locate(&db(), "501b297447a8255d3533c6858bb692575cdefaa0");
}
1 change: 1 addition & 0 deletions git-odb/tests/odb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn fixture_path(path: &str) -> PathBuf {
}

mod alternate;
mod compound;
mod loose;
mod pack;
mod sink;

0 comments on commit d629339

Please sign in to comment.