@@ -34,6 +34,7 @@ const USER_AGENT: &str = "docs.rs builder (https://github.com/rust-lang/docs.rs)
3434const  COMPONENTS :  & [ & str ]  = & [ "llvm-tools-preview" ,  "rustc-dev" ,  "rustfmt" ] ; 
3535const  DUMMY_CRATE_NAME :  & str  = "empty-library" ; 
3636const  DUMMY_CRATE_VERSION :  & str  = "1.0.0" ; 
37+ const  DUMMY_CRATE_PUBLISHER_ID :  & str  = "2299951" ;  // pietroalbini 
3738
3839#[ derive( Debug ) ]  
3940pub  enum  PackageKind < ' a >  { 
@@ -1129,6 +1130,42 @@ mod tests {
11291130        } ) 
11301131    } 
11311132
1133+     #[ test]  
1134+     #[ ignore]  
1135+     fn  test_artifact_cache ( )  { 
1136+         wrapper ( |env| { 
1137+             let  crate_ = DUMMY_CRATE_NAME ; 
1138+             let  version = DUMMY_CRATE_VERSION ; 
1139+             let  expected_cache_dir = env
1140+                 . config ( ) 
1141+                 . prefix 
1142+                 . join ( "artifact_cache" ) 
1143+                 . join ( DUMMY_CRATE_PUBLISHER_ID ) ; 
1144+ 
1145+             let  mut  builder = RustwideBuilder :: init ( env) . unwrap ( ) ; 
1146+ 
1147+             // first build creates the cache 
1148+             assert ! ( !expected_cache_dir. exists( ) ) ; 
1149+             assert ! ( builder. build_package( crate_,  version,  PackageKind :: CratesIo ) ?) ; 
1150+             assert ! ( expected_cache_dir. exists( ) ) ; 
1151+ 
1152+             // cache dir doesn't contain doc output 
1153+             assert ! ( !expected_cache_dir. join( "doc" ) . exists( ) ) ; 
1154+ 
1155+             // but seems to be a normal cargo target directory 
1156+             for  expected_file in  & [ "CACHEDIR.TAG" ,  "debug" ]  { 
1157+                 assert ! ( expected_cache_dir. join( expected_file) . exists( ) ) ; 
1158+             } 
1159+ 
1160+             // do a second build 
1161+             assert ! ( builder. build_package( crate_,  version,  PackageKind :: CratesIo ) ?) ; 
1162+ 
1163+             // FIXME: how would I know if the cache was used? 
1164+ 
1165+             Ok ( ( ) ) 
1166+         } ) ; 
1167+     } 
1168+ 
11321169    #[ test]  
11331170    #[ ignore]  
11341171    fn  test_proc_macro ( )  { 
0 commit comments