Skip to content

Commit 747a592

Browse files
committed
test: Add a test for cargo tree --duplicates with a proc-macro
1 parent 284fd3f commit 747a592

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

tests/testsuite/tree.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,66 @@ fn duplicates_with_target() {
10851085
p.cargo("tree -d --target=all").with_stdout("").run();
10861086
}
10871087

1088+
#[cargo_test]
1089+
fn duplicates_with_proc_macro() {
1090+
Package::new("dupe-dep", "1.0.0").publish();
1091+
Package::new("dupe-dep", "2.0.0").publish();
1092+
Package::new("proc", "1.0.0")
1093+
.proc_macro(true)
1094+
.dep("dupe-dep", "1.0")
1095+
.publish();
1096+
let p = project()
1097+
.file(
1098+
"Cargo.toml",
1099+
r#"
1100+
[package]
1101+
name = "foo"
1102+
version = "0.1.0"
1103+
1104+
[dependencies]
1105+
proc = "1.0"
1106+
dupe-dep = "2.0"
1107+
"#,
1108+
)
1109+
.file("src/lib.rs", "")
1110+
.build();
1111+
1112+
p.cargo("tree")
1113+
.with_stdout(
1114+
"\
1115+
foo v0.1.0 ([..]/foo)
1116+
├── dupe-dep v2.0.0
1117+
└── proc v1.0.0 (proc-macro)
1118+
└── dupe-dep v1.0.0
1119+
",
1120+
)
1121+
.run();
1122+
1123+
p.cargo("tree --duplicates")
1124+
.with_stdout(
1125+
"\
1126+
dupe-dep v1.0.0
1127+
└── proc v1.0.0 (proc-macro)
1128+
└── foo v0.1.0 ([..]/foo)
1129+
1130+
dupe-dep v2.0.0
1131+
└── foo v0.1.0 ([..]/foo)
1132+
",
1133+
)
1134+
.run();
1135+
1136+
p.cargo("tree --duplicates --edges no-proc-macro")
1137+
.with_stdout(
1138+
"\
1139+
dupe-dep v1.0.0
1140+
1141+
dupe-dep v2.0.0
1142+
└── foo v0.1.0 ([..]/foo)
1143+
",
1144+
)
1145+
.run();
1146+
}
1147+
10881148
#[cargo_test]
10891149
fn charset() {
10901150
let p = make_simple_proj();

0 commit comments

Comments
 (0)