Skip to content

Commit 385dfb6

Browse files
epageEh2406
authored andcommitted
test(registry): Show current too-new schema error
This reproduces the problem in #10623.
1 parent 293b71a commit 385dfb6

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/testsuite/registry.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,6 +2632,41 @@ fn ignores_unknown_index_version() {
26322632
.run();
26332633
}
26342634

2635+
#[cargo_test]
2636+
fn unknown_index_version_error() {
2637+
// If the version field is not understood, it is ignored.
2638+
Package::new("bar", "1.0.1")
2639+
.schema_version(u32::MAX)
2640+
.publish();
2641+
2642+
let p = project()
2643+
.file(
2644+
"Cargo.toml",
2645+
r#"
2646+
[package]
2647+
name = "foo"
2648+
version = "0.1.0"
2649+
2650+
[dependencies]
2651+
bar = "1.0"
2652+
"#,
2653+
)
2654+
.file("src/lib.rs", "")
2655+
.build();
2656+
2657+
p.cargo("generate-lockfile")
2658+
.with_status(101)
2659+
.with_stderr(
2660+
"\
2661+
[UPDATING] `dummy-registry` index
2662+
[ERROR] no matching package named `bar` found
2663+
location searched: registry `crates-io`
2664+
required by package `foo v0.1.0 ([CWD])`
2665+
",
2666+
)
2667+
.run();
2668+
}
2669+
26352670
#[cargo_test]
26362671
fn protocol() {
26372672
cargo_process("install bar")

0 commit comments

Comments
 (0)