File tree 2 files changed +44
-4
lines changed
fixtures/generated-archives
2 files changed +44
-4
lines changed Original file line number Diff line number Diff line change 1
1
version https://git-lfs.github.com/spec/v1
2
- oid sha256:0a85fe0b4d9fb179baab26ea008ddbb48a657d4e92561c42a213269468481a66
3
- size 9308
2
+ oid sha256:5aac946f32882b76ca1a1d980cdd56fb812e9059ba59074ef141dd0bb4b32903
3
+ size 9320
Original file line number Diff line number Diff line change
1
+ use bstr:: ByteSlice ;
2
+ use git_refspec:: Operation ;
1
3
use git_testtools:: scripted_fixture_repo_read_only;
4
+ use std:: panic:: catch_unwind;
2
5
3
6
#[ test]
4
- #[ ignore ]
7
+ #[ should_panic ]
5
8
fn baseline ( ) {
6
- let _dir = scripted_fixture_repo_read_only ( "make_baseline.sh" ) . unwrap ( ) ;
9
+ let dir = scripted_fixture_repo_read_only ( "make_baseline.sh" ) . unwrap ( ) ;
10
+ let baseline = std:: fs:: read ( dir. join ( "baseline.git" ) ) . unwrap ( ) ;
11
+ let mut lines = baseline. lines ( ) ;
12
+ let mut panics = 0 ;
13
+ let mut mismatch = 0 ;
14
+ let mut count = 0 ;
15
+ while let Some ( kind_spec) = lines. next ( ) {
16
+ count += 1 ;
17
+ let ( kind, spec) = kind_spec. split_at ( kind_spec. find_byte ( b' ' ) . expect ( "space between kind and spec" ) ) ;
18
+ let err_code: usize = lines
19
+ . next ( )
20
+ . expect ( "err code" )
21
+ . to_str ( )
22
+ . unwrap ( )
23
+ . parse ( )
24
+ . expect ( "number" ) ;
25
+ let op = match kind {
26
+ b"fetch" => Operation :: Fetch ,
27
+ b"push" => Operation :: Push ,
28
+ _ => unreachable ! ( "{} unexpected" , kind. as_bstr( ) ) ,
29
+ } ;
30
+ let res = catch_unwind ( || try_parse ( spec. to_str ( ) . unwrap ( ) , op) ) ;
31
+ match res {
32
+ Ok ( res) => match ( res. is_ok ( ) , err_code == 0 ) {
33
+ ( true , true ) | ( false , false ) => { }
34
+ _ => mismatch += 1 ,
35
+ } ,
36
+ Err ( _) => {
37
+ panics += 1 ;
38
+ }
39
+ }
40
+ }
41
+ if panics != 0 || mismatch != 0 {
42
+ panic ! (
43
+ "Out of {} baseline entries, got {} mismatches and {} panics" ,
44
+ count, mismatch, panics
45
+ ) ;
46
+ }
7
47
}
8
48
9
49
mod invalid {
You can’t perform that action at this time.
0 commit comments