@@ -1035,8 +1035,33 @@ mod tests {
1035
1035
wrapper ( |env| {
1036
1036
env. override_config ( |cfg| cfg. include_default_targets = false ) ;
1037
1037
1038
- let crate_ = "stm32f7xx-hal" ;
1039
- let version = "0.6.0" ;
1038
+ // if the corrected dependency of the crate was already downloaded we need to remove it
1039
+ let crate_file = env. config ( ) . rustwide_workspace . join (
1040
+ "cargo-home/registry/cache/git.cakeli.workers.dev-1ecc6299db9ec823/rand_core-0.5.1.crate" ,
1041
+ ) ;
1042
+ let src_dir = env
1043
+ . config ( )
1044
+ . rustwide_workspace
1045
+ . join ( "cargo-home/registry/src/git.cakeli.workers.dev-1ecc6299db9ec823/rand_core-0.5.1" ) ;
1046
+
1047
+ if crate_file. exists ( ) {
1048
+ info ! ( "deleting {}" , crate_file. display( ) ) ;
1049
+ std:: fs:: remove_file ( crate_file) ?;
1050
+ }
1051
+ if src_dir. exists ( ) {
1052
+ info ! ( "deleting {}" , src_dir. display( ) ) ;
1053
+ std:: fs:: remove_dir_all ( src_dir) ?;
1054
+ }
1055
+
1056
+ // Specific setup required:
1057
+ // * crate has a binary so that it is published with a lockfile
1058
+ // * crate has a library so that it is documented by docs.rs
1059
+ // * crate has an optional dependency
1060
+ // * metadata enables the optional dependency for docs.rs
1061
+ // * `cargo doc` fails with the version of the dependency in the lockfile
1062
+ // * there is a newer version of the dependency available that correctly builds
1063
+ let crate_ = "docs_rs_test_incorrect_lockfile" ;
1064
+ let version = "0.1.2" ;
1040
1065
let mut builder = RustwideBuilder :: init ( env) . unwrap ( ) ;
1041
1066
assert ! ( builder. build_package( crate_, version, PackageKind :: CratesIo ) ?) ;
1042
1067
0 commit comments