From a892cbfdcfed941aae3d2e0eb91e14b72b045062 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 8 Sep 2023 20:51:05 +0000 Subject: [PATCH] test(registry): Show current too-new schema error This reproduces the problem in #10623. --- tests/testsuite/registry.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/testsuite/registry.rs b/tests/testsuite/registry.rs index 2181f2ebb2b4..51bacc322208 100644 --- a/tests/testsuite/registry.rs +++ b/tests/testsuite/registry.rs @@ -2632,6 +2632,41 @@ fn ignores_unknown_index_version() { .run(); } +#[cargo_test] +fn unknown_index_version_error() { + // If the version field is not understood, it is ignored. + Package::new("bar", "1.0.1") + .schema_version(u32::MAX) + .publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + + [dependencies] + bar = "1.0" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("generate-lockfile") + .with_status(101) + .with_stderr( + "\ +[UPDATING] `dummy-registry` index +[ERROR] no matching package named `bar` found +location searched: registry `crates-io` +required by package `foo v0.1.0 ([CWD])` +", + ) + .run(); +} + #[cargo_test] fn protocol() { cargo_process("install bar")