File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,23 @@ mod tests {
47
47
#[ test]
48
48
#[ serial_test:: serial]
49
49
fn build_version_with_env ( ) {
50
+ let maybe_git_hash = option_env ! ( "GIRT_BUILD_GIT_HASH" ) ;
51
+ assert_eq ! (
52
+ std:: process:: Command :: new( "git" )
53
+ . args( [ "rev-parse" , "--is-inside-work-tree" ] )
54
+ . output( )
55
+ . map( |out| out. status. success( ) )
56
+ . unwrap_or( false ) ,
57
+ maybe_git_hash. is_some( )
58
+ ) ;
59
+
50
60
let version = build_version ( ) ;
51
- let expected_meta = format ! ( "({} {})" , env!( "GIRT_BUILD_GIT_HASH" ) , env!( "GIRT_BUILD_DATE" ) ) ;
61
+ let expected_meta = if let Some ( git_hash) = maybe_git_hash {
62
+ format ! ( "({} {})" , git_hash, env!( "GIRT_BUILD_DATE" ) )
63
+ }
64
+ else {
65
+ format ! ( "({})" , env!( "GIRT_BUILD_DATE" ) )
66
+ } ;
52
67
assert ! ( version. starts_with( "interactive-rebase-tool" ) ) ;
53
68
assert ! ( version. ends_with( expected_meta. as_str( ) ) ) ;
54
69
}
You can’t perform that action at this time.
0 commit comments