File tree 1 file changed +18
-2
lines changed
gix-revision/tests/revision/spec/parse/navigate
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 1
- use gix_revision:: { spec, spec:: parse:: delegate:: Traversal } ;
2
-
3
1
use crate :: spec:: parse:: { parse, try_parse, PeelToOwned as PeelTo } ;
2
+ use gix_revision:: { spec, spec:: parse:: delegate:: Traversal } ;
4
3
5
4
#[ test]
6
5
fn single_is_first_parent ( ) {
@@ -190,6 +189,23 @@ fn invalid_object_type() {
190
189
) ;
191
190
}
192
191
192
+ #[ test]
193
+ fn invalid_caret_without_previous_refname ( ) {
194
+ let rec = parse ( r"^^" ) ;
195
+ assert_eq ! ( rec. calls, 2 ) ;
196
+ assert_eq ! ( rec. kind, Some ( gix_revision:: spec:: Kind :: ExcludeReachable ) ) ;
197
+ assert_eq ! (
198
+ rec. traversal,
199
+ [ Traversal :: NthParent ( 1 ) ] ,
200
+ "This can trip off an implementation as it's actually invalid, but looks valid"
201
+ ) ;
202
+
203
+ for revspec in [ "^^^HEAD" , "^^HEAD" ] {
204
+ let err = try_parse ( revspec) . unwrap_err ( ) ;
205
+ assert ! ( matches!( err, spec:: parse:: Error :: UnconsumedInput { input} if input == "HEAD" ) ) ;
206
+ }
207
+ }
208
+
193
209
#[ test]
194
210
fn incomplete_escaped_braces_in_regex_are_invalid ( ) {
195
211
let err = try_parse ( r"@^{/a\{1}}" ) . unwrap_err ( ) ;
You can’t perform that action at this time.
0 commit comments