@@ -8,43 +8,54 @@ fn empty() {
8
8
9
9
#[ test]
10
10
fn negative_must_not_be_empty ( ) {
11
- for op in [ Operation :: Fetch , Operation :: Push ] {
12
- assert ! ( matches!( try_parse( "^" , op) . unwrap_err( ) , Error :: NegativeEmpty ) ) ;
13
- }
11
+ assert ! ( matches!(
12
+ try_parse( "^" , Operation :: Fetch ) . unwrap_err( ) ,
13
+ Error :: NegativeEmpty
14
+ ) ) ;
14
15
}
15
16
16
17
#[ test]
17
18
fn negative_must_not_be_object_hash ( ) {
18
- for op in [ Operation :: Fetch , Operation :: Push ] {
19
+ assert ! ( matches!(
20
+ try_parse( "^e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" , Operation :: Fetch ) . unwrap_err( ) ,
21
+ Error :: NegativeObjectHash
22
+ ) ) ;
23
+ }
24
+
25
+ #[ test]
26
+ fn negative_with_destination ( ) {
27
+ for spec in [ "^a:b" , "^a:" , "^:" , "^:b" ] {
19
28
assert ! ( matches!(
20
- try_parse( "^e69de29bb2d1d6434b8b29ae775ad8c2e48c5391" , op ) . unwrap_err( ) ,
21
- Error :: NegativeObjectHash
29
+ try_parse( spec , Operation :: Fetch ) . unwrap_err( ) ,
30
+ Error :: NegativeWithDestination
22
31
) ) ;
23
32
}
24
33
}
25
34
26
35
#[ test]
27
- fn negative_with_destination ( ) {
28
- for op in [ Operation :: Fetch , Operation :: Push ] {
29
- for spec in [ "^a:b" , "^a:" , "^:" , "^:b" ] {
30
- assert ! ( matches!(
31
- try_parse( spec, op) . unwrap_err( ) ,
32
- Error :: NegativeWithDestination
33
- ) ) ;
34
- }
36
+ fn negative_unsupported_when_pushing ( ) {
37
+ for spec in [ "^a:b" , "^a:" , "^:" , "^:b" , "^" ] {
38
+ assert ! ( matches!(
39
+ try_parse( spec, Operation :: Push ) . unwrap_err( ) ,
40
+ Error :: NegativeUnsupported
41
+ ) ) ;
35
42
}
36
43
}
37
44
38
45
#[ test]
39
46
fn complex_patterns_with_more_than_one_asterisk ( ) {
40
47
for op in [ Operation :: Fetch , Operation :: Push ] {
41
- for spec in [ "^*/*" , " a/*/c/*", "a**:**b" , "+:**/" ] {
48
+ for spec in [ "a/*/c/*" , "a**:**b" , "+:**/" ] {
42
49
assert ! ( matches!(
43
50
try_parse( spec, op) . unwrap_err( ) ,
44
51
Error :: PatternUnsupported { .. }
45
52
) ) ;
46
53
}
47
54
}
55
+ assert ! ( matches!(
56
+ try_parse( "^*/*" , Operation :: Fetch ) . unwrap_err( ) ,
57
+ Error :: PatternUnsupported { .. }
58
+ ) ) ;
48
59
}
49
60
50
61
#[ test]
0 commit comments