Skip to content

Commit e906797

Browse files
committed
Add test case for confilict README.md check
Signed-off-by: Eval EXEC <[email protected]>
1 parent 1dde1e1 commit e906797

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

tests/testsuite/package.rs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,6 +2535,91 @@ See [..]
25352535
assert!(p.root().join("target/package/bar-0.0.1.crate").is_file());
25362536
}
25372537

2538+
#[cargo_test]
2539+
fn workspace_noconflict_readme() {
2540+
let p = project()
2541+
.file(
2542+
"Cargo.toml",
2543+
r#"
2544+
[workspace]
2545+
members = ["bar"]
2546+
"#,
2547+
)
2548+
.file("README.md", "workspace readme")
2549+
.file(
2550+
"bar/Cargo.toml",
2551+
r#"
2552+
[package]
2553+
name = "bar"
2554+
version = "0.0.1"
2555+
repository = "https://github.com/bar/bar"
2556+
authors = []
2557+
license = "MIT"
2558+
description = "bar"
2559+
readme = "../README.md"
2560+
workspace = ".."
2561+
"#,
2562+
)
2563+
.file("bar/src/main.rs", "fn main() {}")
2564+
.file("bar/example/README.md", "# example readmdBar")
2565+
.build();
2566+
2567+
p.cargo("package")
2568+
.with_stderr(
2569+
"\
2570+
[PACKAGING] bar v0.0.1 ([CWD]/bar)
2571+
[VERIFYING] bar v0.0.1 ([CWD]/bar)
2572+
[COMPILING] bar v0.0.1 ([CWD]/[..])
2573+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2574+
[PACKAGED] [..] files, [..] ([..] compressed)
2575+
",
2576+
)
2577+
.run();
2578+
}
2579+
2580+
#[cargo_test]
2581+
fn workspace_conflict_readme() {
2582+
let p = project()
2583+
.file(
2584+
"Cargo.toml",
2585+
r#"
2586+
[workspace]
2587+
members = ["bar"]
2588+
"#,
2589+
)
2590+
.file("README.md", "workspace readme")
2591+
.file(
2592+
"bar/Cargo.toml",
2593+
r#"
2594+
[package]
2595+
name = "bar"
2596+
version = "0.0.1"
2597+
repository = "https://github.com/bar/bar"
2598+
authors = []
2599+
license = "MIT"
2600+
description = "bar"
2601+
readme = "../README.md"
2602+
workspace = ".."
2603+
"#,
2604+
)
2605+
.file("bar/src/main.rs", "fn main() {}")
2606+
.file("bar/README.md", "# workspace member: Bar")
2607+
.build();
2608+
2609+
p.cargo("package")
2610+
.with_stderr(
2611+
"\
2612+
warning: readme `../README.md` appears to be a path outside of the package, but there is already a file named `README.md` in the root of the package. The archived crate will contain the copy in the root of the package. Update the readme to point to the path relative to the root of the package to remove this warning.
2613+
[PACKAGING] bar v0.0.1 ([CWD]/bar)
2614+
[VERIFYING] bar v0.0.1 ([CWD]/bar)
2615+
[COMPILING] bar v0.0.1 ([CWD]/[..])
2616+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2617+
[PACKAGED] [..] files, [..] ([..] compressed)
2618+
",
2619+
)
2620+
.run();
2621+
}
2622+
25382623
#[cargo_test]
25392624
fn workspace_overrides_resolver() {
25402625
let p = project()

0 commit comments

Comments
 (0)