@@ -44,6 +44,7 @@ impl<'a> Baseline<'a> {
4444#[ ignore]
4545fn compare_baseline_with_ours ( ) {
4646 let dir = git_testtools:: scripted_fixture_repo_read_only ( "make_baseline.sh" ) . unwrap ( ) ;
47+ let ( mut total_matches, mut total_correct) = ( 0 , 0 ) ;
4748 for ( input_file, expected_matches) in & [ ( "git-baseline.match" , true ) , ( "git-baseline.nmatch" , false ) ] {
4849 let input = std:: fs:: read ( dir. join ( * input_file) ) . unwrap ( ) ;
4950 let mut seen = BTreeSet :: default ( ) ;
@@ -54,24 +55,27 @@ fn compare_baseline_with_ours() {
5455 is_match,
5556 } in Baseline :: new ( & input)
5657 {
58+ total_matches += 1 ;
5759 assert ! ( seen. insert( m) , "duplicate match entry: {:?}" , m) ;
5860 assert_eq ! (
5961 is_match, * expected_matches,
6062 "baseline for matches must indeed be {} - check baseline and git version: {:?}" ,
6163 expected_matches, m
6264 ) ;
6365 let pattern = git_glob:: Pattern :: from_bytes ( pattern) . expect ( "parsing works" ) ;
64- assert_eq ! (
65- pattern . matches_path (
66- value ,
67- value . rfind_byte ( b'/' ) . map ( |pos| pos + 1 ) ,
68- false , // TODO: does it make sense to pretent it is a dir and see what happens?
69- pattern :: Case :: Sensitive
70- ) ,
71- is_match
72- )
66+ let actual_match = pattern . matches_path (
67+ value ,
68+ value . rfind_byte ( b'/' ) . map ( |pos| pos + 1 ) ,
69+ false , // TODO: does it make sense to pretent it is a dir and see what happens?
70+ pattern :: Case :: Sensitive ,
71+ ) ;
72+ if actual_match == is_match {
73+ total_correct += 1 ;
74+ }
7375 }
7476 }
77+
78+ assert_eq ! ( total_correct, total_matches, "We perfectly agree with git here" ) ;
7579}
7680
7781#[ test]
0 commit comments