@@ -2,13 +2,27 @@ use crate::fixture_path;
2
2
use git_odb:: pack;
3
3
use std:: convert:: TryFrom ;
4
4
5
- fn new_pack ( at : & str ) -> pack:: File {
5
+ fn pack_at ( at : & str ) -> pack:: File {
6
6
pack:: File :: try_from ( fixture_path ( at) . as_path ( ) ) . unwrap ( )
7
7
}
8
8
9
+ mod method {
10
+ use crate :: pack:: file:: pack_at;
11
+ use crate :: pack:: SMALL_PACK ;
12
+
13
+ #[ test]
14
+ fn checksum ( ) {
15
+ let p = pack_at ( SMALL_PACK ) ;
16
+ assert_eq ! (
17
+ hex:: encode( p. checksum( ) ) ,
18
+ "0f3ea84cd1bba10c2a03d736a460635082833e59"
19
+ ) ;
20
+ }
21
+ }
22
+
9
23
/// All hardcoded offsets are obtained via `git verify-pack --verbose tests/fixtures/packs/pack-a2bf8e71d8c18879e499335762dd95119d93d9f1.idx`
10
24
mod decode_entry {
11
- use crate :: { pack:: file:: new_pack , pack:: SMALL_PACK } ;
25
+ use crate :: { pack:: file:: pack_at , pack:: SMALL_PACK } ;
12
26
use bstr:: ByteSlice ;
13
27
use git_odb:: pack:: ResolvedBase ;
14
28
@@ -44,7 +58,7 @@ mod decode_entry {
44
58
panic ! ( "should not want to resolve an id here" )
45
59
}
46
60
47
- let p = new_pack ( SMALL_PACK ) ;
61
+ let p = pack_at ( SMALL_PACK ) ;
48
62
let entry = p. entry ( offset) ;
49
63
let mut buf = Vec :: new ( ) ;
50
64
p. decode_entry ( entry, & mut buf, resolve_with_panic) . unwrap ( ) ;
@@ -53,7 +67,7 @@ mod decode_entry {
53
67
}
54
68
55
69
mod decompress_entry {
56
- use crate :: { pack:: file:: new_pack , pack:: SMALL_PACK } ;
70
+ use crate :: { pack:: file:: pack_at , pack:: SMALL_PACK } ;
57
71
use bstr:: ByteSlice ;
58
72
59
73
#[ test]
@@ -93,7 +107,7 @@ mod decompress_entry {
93
107
}
94
108
95
109
fn decompress_entry_at_offset ( offset : u64 ) -> Vec < u8 > {
96
- let p = new_pack ( SMALL_PACK ) ;
110
+ let p = pack_at ( SMALL_PACK ) ;
97
111
let entry = p. entry ( offset) ;
98
112
99
113
let size = entry. size as usize ;
0 commit comments