diff --git a/src/docbuilder/rustwide_builder.rs b/src/docbuilder/rustwide_builder.rs index 77d7e3829..5f0242e58 100644 --- a/src/docbuilder/rustwide_builder.rs +++ b/src/docbuilder/rustwide_builder.rs @@ -1802,13 +1802,11 @@ mod tests { // * metadata enables the optional dependency for docs.rs // * `cargo doc` fails with the version of the dependency in the lockfile // * there is a newer version of the dependency available that correctly builds - let crate_ = "docs_rs_test_incorrect_lockfile"; - let version = "0.1.2"; let mut builder = RustwideBuilder::init(&env.context).unwrap(); builder.update_toolchain()?; assert!( builder - .build_package(crate_, version, PackageKind::CratesIo, false)? + .build_local_package(Path::new("tests/crates/incorrect_lockfile_0_1"))? .successful ); @@ -1831,13 +1829,11 @@ mod tests { // lockfile, but generating a new working lockfile requires // introducing a completely new dependency (not just version) which // would not have had its details pulled down from the sparse-index. - let crate_ = "docs_rs_test_incorrect_lockfile"; - let version = "0.2.0"; let mut builder = RustwideBuilder::init(&env.context).unwrap(); builder.update_toolchain()?; assert!( builder - .build_package(crate_, version, PackageKind::CratesIo, false)? + .build_local_package(Path::new("tests/crates/incorrect_lockfile_0_2"))? .successful ); diff --git a/tests/crates/incorrect_lockfile_0_1/Cargo.lock b/tests/crates/incorrect_lockfile_0_1/Cargo.lock new file mode 100644 index 000000000..688db7de4 --- /dev/null +++ b/tests/crates/incorrect_lockfile_0_1/Cargo.lock @@ -0,0 +1,16 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "docs_rs_test_incorrect_lockfile" +version = "0.1.2" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca" diff --git a/tests/crates/incorrect_lockfile_0_1/Cargo.toml b/tests/crates/incorrect_lockfile_0_1/Cargo.toml new file mode 100644 index 000000000..02c556445 --- /dev/null +++ b/tests/crates/incorrect_lockfile_0_1/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "docs_rs_test_incorrect_lockfile" +version = "0.1.2" +edition = "2021" +description = """ +Test crate for docs.rs build tests +""" +license = "MIT OR Apache-2.0" + +[dependencies] +rand_core.version = "0.5" +rand_core.optional = true + +[package.metadata.docs.rs] +features = ["rand_core"] diff --git a/tests/crates/incorrect_lockfile_0_1/src/lib.rs b/tests/crates/incorrect_lockfile_0_1/src/lib.rs new file mode 100644 index 000000000..44b210d24 --- /dev/null +++ b/tests/crates/incorrect_lockfile_0_1/src/lib.rs @@ -0,0 +1 @@ +pub const _: u32 = rand_core::Error::INTERNAL_START; diff --git a/tests/crates/incorrect_lockfile_0_1/src/main.rs b/tests/crates/incorrect_lockfile_0_1/src/main.rs new file mode 100644 index 000000000..e69de29bb diff --git a/tests/crates/incorrect_lockfile_0_2/Cargo.lock b/tests/crates/incorrect_lockfile_0_2/Cargo.lock new file mode 100644 index 000000000..0eac8532a --- /dev/null +++ b/tests/crates/incorrect_lockfile_0_2/Cargo.lock @@ -0,0 +1,95 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "ctor" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "docs_rs_test_incorrect_lockfile" +version = "0.2.0" +dependencies = [ + "log", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", + "sval", + "value-bag", +] + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "sval" +version = "1.0.0-alpha.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45f6ee7c7b87caf59549e9fe45d6a69c75c8019e79e212a835c5da0e92f0ba08" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "value-bag" +version = "1.0.0-alpha.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" +dependencies = [ + "ctor", + "sval", + "version_check", +] + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/tests/crates/incorrect_lockfile_0_2/Cargo.toml b/tests/crates/incorrect_lockfile_0_2/Cargo.toml new file mode 100644 index 000000000..6eb5c20ed --- /dev/null +++ b/tests/crates/incorrect_lockfile_0_2/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "docs_rs_test_incorrect_lockfile" +version = "0.2.0" +edition = "2021" +description = """ +Test crate for docs.rs build tests +""" +license = "MIT OR Apache-2.0" + +[dependencies] +log.version = "0.4.17" +log.features = ["kv_unstable_sval"] diff --git a/tests/crates/incorrect_lockfile_0_2/src/lib.rs b/tests/crates/incorrect_lockfile_0_2/src/lib.rs new file mode 100644 index 000000000..e69de29bb diff --git a/tests/crates/incorrect_lockfile_0_2/src/main.rs b/tests/crates/incorrect_lockfile_0_2/src/main.rs new file mode 100644 index 000000000..e69de29bb