@@ -6,7 +6,7 @@ use once_cell::sync::Lazy;
6
6
7
7
type Result < T = ( ) > = std:: result:: Result < T , Box < dyn std:: error:: Error > > ;
8
8
9
- static BASELINE : Lazy < HashMap < BString , ( usize , BString ) > > = Lazy :: new ( || {
9
+ static BASELINE : Lazy < HashMap < BString , ( usize , u32 ) > > = Lazy :: new ( || {
10
10
let base = git_testtools:: scripted_fixture_repo_read_only ( "generate_git_date_baseline.sh" ) . unwrap ( ) ;
11
11
12
12
( || -> Result < _ > {
@@ -15,7 +15,14 @@ static BASELINE: Lazy<HashMap<BString, (usize, BString)>> = Lazy::new(|| {
15
15
let mut lines = baseline. lines ( ) ;
16
16
while let Some ( date_str) = lines. next ( ) {
17
17
let exit_code = lines. next ( ) . expect ( "three lines per baseline" ) . to_str ( ) ?. parse ( ) ?;
18
- let output = lines. next ( ) . expect ( "three lines per baseline" ) . into ( ) ;
18
+ let output = u32:: from_str (
19
+ lines
20
+ . next ( )
21
+ . expect ( "three lines per baseline" )
22
+ . to_str ( )
23
+ . expect ( "valid utf" ) ,
24
+ )
25
+ . expect ( "valid epoch value" ) ;
19
26
map. insert ( date_str. into ( ) , ( exit_code, output) ) ;
20
27
}
21
28
Ok ( map)
@@ -34,8 +41,7 @@ fn baseline() {
34
41
) ;
35
42
if * exit_code == 0 {
36
43
let actual = res. unwrap ( ) . seconds_since_unix_epoch ;
37
- let expected = u32:: from_str ( output. to_str ( ) . expect ( "valid utf" ) ) . expect ( "valid epoch value" ) ;
38
- assert_eq ! ( actual, expected, "{pattern:?} disagrees with baseline: {actual:?}" )
44
+ assert_eq ! ( actual, * output, "{pattern:?} disagrees with baseline: {actual:?}" )
39
45
}
40
46
}
41
47
}
0 commit comments