@@ -149,7 +149,7 @@ struct Fixture {
149
149
150
150
impl Fixture {
151
151
fn new ( ) -> gix_testtools:: Result < Fixture > {
152
- Self :: for_worktree_path ( fixture_path ( ) )
152
+ Self :: for_worktree_path ( fixture_path ( ) ? )
153
153
}
154
154
155
155
fn for_worktree_path ( worktree_path : PathBuf ) -> gix_testtools:: Result < Fixture > {
@@ -212,7 +212,7 @@ impl Fixture {
212
212
macro_rules! mktest {
213
213
( $name: ident, $case: expr, $number_of_lines: literal) => {
214
214
#[ test]
215
- fn $name( ) -> gix_testtools:: Result < ( ) > {
215
+ fn $name( ) -> gix_testtools:: Result {
216
216
let Fixture {
217
217
odb,
218
218
mut resource_cache,
@@ -238,7 +238,7 @@ macro_rules! mktest {
238
238
239
239
assert_eq!( lines_blamed. len( ) , $number_of_lines) ;
240
240
241
- let git_dir = fixture_path( ) . join( ".git" ) ;
241
+ let git_dir = fixture_path( ) ? . join( ".git" ) ;
242
242
let baseline = Baseline :: collect( git_dir. join( format!( "{}.baseline" , $case) ) , source_file_name) ?;
243
243
244
244
assert_eq!( baseline. len( ) , $number_of_lines) ;
@@ -324,20 +324,20 @@ fn diff_disparity() {
324
324
325
325
assert_eq ! ( lines_blamed. len( ) , 5 ) ;
326
326
327
- let git_dir = fixture_path ( ) . join ( ".git" ) ;
327
+ let git_dir = fixture_path ( ) . unwrap ( ) . join ( ".git" ) ;
328
328
let baseline = Baseline :: collect ( git_dir. join ( format ! ( "{case}.baseline" ) ) , source_file_name) . unwrap ( ) ;
329
329
330
330
pretty_assertions:: assert_eq!( lines_blamed, baseline, "{case}" ) ;
331
331
}
332
332
}
333
333
334
334
#[ test]
335
- fn since ( ) {
335
+ fn since ( ) -> gix_testtools :: Result {
336
336
let Fixture {
337
337
odb,
338
338
mut resource_cache,
339
339
suspect,
340
- } = Fixture :: new ( ) . unwrap ( ) ;
340
+ } = Fixture :: new ( ) ? ;
341
341
342
342
let source_file_name: gix_object:: bstr:: BString = "simple.txt" . into ( ) ;
343
343
@@ -350,32 +350,33 @@ fn since() {
350
350
gix_blame:: Options {
351
351
diff_algorithm : gix_diff:: blob:: Algorithm :: Histogram ,
352
352
range : BlameRanges :: default ( ) ,
353
- since : Some ( gix_date:: parse ( "2025-01-31" , None ) . unwrap ( ) ) ,
353
+ since : Some ( gix_date:: parse ( "2025-01-31" , None ) ? ) ,
354
354
rewrites : Some ( gix_diff:: Rewrites :: default ( ) ) ,
355
355
} ,
356
- )
357
- . unwrap ( )
356
+ ) ?
358
357
. entries ;
359
358
360
359
assert_eq ! ( lines_blamed. len( ) , 1 ) ;
361
360
362
- let git_dir = fixture_path ( ) . join ( ".git" ) ;
363
- let baseline = Baseline :: collect ( git_dir. join ( "simple-since.baseline" ) , source_file_name) . unwrap ( ) ;
361
+ let git_dir = fixture_path ( ) ? . join ( ".git" ) ;
362
+ let baseline = Baseline :: collect ( git_dir. join ( "simple-since.baseline" ) , source_file_name) ? ;
364
363
365
364
pretty_assertions:: assert_eq!( lines_blamed, baseline) ;
365
+
366
+ Ok ( ( ) )
366
367
}
367
368
368
369
mod blame_ranges {
369
370
use crate :: { fixture_path, Baseline , Fixture } ;
370
371
use gix_blame:: BlameRanges ;
371
372
372
373
#[ test]
373
- fn line_range ( ) {
374
+ fn line_range ( ) -> gix_testtools :: Result {
374
375
let Fixture {
375
376
odb,
376
377
mut resource_cache,
377
378
suspect,
378
- } = Fixture :: new ( ) . unwrap ( ) ;
379
+ } = Fixture :: new ( ) ? ;
379
380
380
381
let source_file_name: gix_object:: bstr:: BString = "simple.txt" . into ( ) ;
381
382
@@ -391,25 +392,26 @@ mod blame_ranges {
391
392
since : None ,
392
393
rewrites : Some ( gix_diff:: Rewrites :: default ( ) ) ,
393
394
} ,
394
- )
395
- . unwrap ( )
395
+ ) ?
396
396
. entries ;
397
397
398
398
assert_eq ! ( lines_blamed. len( ) , 2 ) ;
399
399
400
- let git_dir = fixture_path ( ) . join ( ".git" ) ;
401
- let baseline = Baseline :: collect ( git_dir. join ( "simple-lines-1-2.baseline" ) , source_file_name) . unwrap ( ) ;
400
+ let git_dir = fixture_path ( ) ? . join ( ".git" ) ;
401
+ let baseline = Baseline :: collect ( git_dir. join ( "simple-lines-1-2.baseline" ) , source_file_name) ? ;
402
402
403
403
pretty_assertions:: assert_eq!( lines_blamed, baseline) ;
404
+
405
+ Ok ( ( ) )
404
406
}
405
407
406
408
#[ test]
407
- fn multiple_ranges_using_add_range ( ) {
409
+ fn multiple_ranges_using_add_range ( ) -> gix_testtools :: Result {
408
410
let Fixture {
409
411
odb,
410
412
mut resource_cache,
411
413
suspect,
412
- } = Fixture :: new ( ) . unwrap ( ) ;
414
+ } = Fixture :: new ( ) ? ;
413
415
414
416
let mut ranges = BlameRanges :: new ( ) ;
415
417
ranges. add_range ( 1 ..=2 ) ; // Lines 1-2
@@ -430,29 +432,29 @@ mod blame_ranges {
430
432
since : None ,
431
433
rewrites : None ,
432
434
} ,
433
- )
434
- . unwrap ( )
435
+ ) ?
435
436
. entries ;
436
437
437
438
assert_eq ! ( lines_blamed. len( ) , 3 ) ; // Should have 3 lines total (2 from first range + 1 from second range)
438
439
439
- let git_dir = fixture_path ( ) . join ( ".git" ) ;
440
+ let git_dir = fixture_path ( ) ? . join ( ".git" ) ;
440
441
let baseline = Baseline :: collect (
441
442
git_dir. join ( "simple-lines-multiple-1-2-and-4.baseline" ) ,
442
443
source_file_name,
443
- )
444
- . unwrap ( ) ;
444
+ ) ?;
445
445
446
446
pretty_assertions:: assert_eq!( lines_blamed, baseline) ;
447
+
448
+ Ok ( ( ) )
447
449
}
448
450
449
451
#[ test]
450
- fn multiple_ranges_usingfrom_ranges ( ) {
452
+ fn multiple_ranges_using_from_ranges ( ) -> gix_testtools :: Result {
451
453
let Fixture {
452
454
odb,
453
455
mut resource_cache,
454
456
suspect,
455
- } = Fixture :: new ( ) . unwrap ( ) ;
457
+ } = Fixture :: new ( ) ? ;
456
458
457
459
let ranges = BlameRanges :: from_ranges ( vec ! [ 1 ..=2 , 1 ..=1 , 4 ..=4 ] ) ;
458
460
@@ -470,20 +472,20 @@ mod blame_ranges {
470
472
since : None ,
471
473
rewrites : None ,
472
474
} ,
473
- )
474
- . unwrap ( )
475
+ ) ?
475
476
. entries ;
476
477
477
478
assert_eq ! ( lines_blamed. len( ) , 3 ) ; // Should have 3 lines total (2 from first range + 1 from second range)
478
479
479
- let git_dir = fixture_path ( ) . join ( ".git" ) ;
480
+ let git_dir = fixture_path ( ) ? . join ( ".git" ) ;
480
481
let baseline = Baseline :: collect (
481
482
git_dir. join ( "simple-lines-multiple-1-2-and-4.baseline" ) ,
482
483
source_file_name,
483
- )
484
- . unwrap ( ) ;
484
+ ) ?;
485
485
486
486
pretty_assertions:: assert_eq!( lines_blamed, baseline) ;
487
+
488
+ Ok ( ( ) )
487
489
}
488
490
}
489
491
@@ -493,14 +495,14 @@ mod rename_tracking {
493
495
use crate :: { Baseline , Fixture } ;
494
496
495
497
#[ test]
496
- fn source_file_name_is_tracked_per_hunk ( ) {
497
- let worktree_path = gix_testtools:: scripted_fixture_read_only ( "make_blame_rename_tracking_repo.sh" ) . unwrap ( ) ;
498
+ fn source_file_name_is_tracked_per_hunk ( ) -> gix_testtools :: Result {
499
+ let worktree_path = gix_testtools:: scripted_fixture_read_only ( "make_blame_rename_tracking_repo.sh" ) ? ;
498
500
499
501
let Fixture {
500
502
odb,
501
503
mut resource_cache,
502
504
suspect,
503
- } = Fixture :: for_worktree_path ( worktree_path. to_path_buf ( ) ) . unwrap ( ) ;
505
+ } = Fixture :: for_worktree_path ( worktree_path. to_path_buf ( ) ) ? ;
504
506
505
507
let source_file_name = "after-rename.txt" ;
506
508
let lines_blamed = gix_blame:: file (
@@ -515,19 +517,20 @@ mod rename_tracking {
515
517
since : None ,
516
518
rewrites : Some ( gix_diff:: Rewrites :: default ( ) ) ,
517
519
} ,
518
- )
519
- . unwrap ( )
520
+ ) ?
520
521
. entries ;
521
522
522
523
assert_eq ! ( lines_blamed. len( ) , 3 ) ;
523
524
524
525
let git_dir = worktree_path. join ( ".git" ) ;
525
- let baseline = Baseline :: collect ( git_dir. join ( "after-rename.baseline" ) , source_file_name. into ( ) ) . unwrap ( ) ;
526
+ let baseline = Baseline :: collect ( git_dir. join ( "after-rename.baseline" ) , source_file_name. into ( ) ) ? ;
526
527
527
528
pretty_assertions:: assert_eq!( lines_blamed, baseline) ;
529
+
530
+ Ok ( ( ) )
528
531
}
529
532
}
530
533
531
- fn fixture_path ( ) -> PathBuf {
532
- gix_testtools:: scripted_fixture_read_only ( "make_blame_repo.sh" ) . unwrap ( )
534
+ fn fixture_path ( ) -> gix_testtools :: Result < PathBuf > {
535
+ gix_testtools:: scripted_fixture_read_only ( "make_blame_repo.sh" )
533
536
}
0 commit comments