@@ -34,6 +34,7 @@ const USER_AGENT: &str = "docs.rs builder (https://github.com/rust-lang/docs.rs)
34
34
const COMPONENTS : & [ & str ] = & [ "llvm-tools-preview" , "rustc-dev" , "rustfmt" ] ;
35
35
const DUMMY_CRATE_NAME : & str = "empty-library" ;
36
36
const DUMMY_CRATE_VERSION : & str = "1.0.0" ;
37
+ const DUMMY_CRATE_PUBLISHER_ID : & str = "2299951" ; // pietroalbini
37
38
38
39
#[ derive( Debug ) ]
39
40
pub enum PackageKind < ' a > {
@@ -1129,6 +1130,42 @@ mod tests {
1129
1130
} )
1130
1131
}
1131
1132
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
+
1132
1169
#[ test]
1133
1170
#[ ignore]
1134
1171
fn test_proc_macro ( ) {
0 commit comments