Skip to content

Commit a5139b9

Browse files
committed
test: cargo tree incorrect --edges arg
1 parent c8af637 commit a5139b9

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

tests/testsuite/tree.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,3 +1573,57 @@ b v0.1.0 ([..]/foo/b)
15731573
)
15741574
.run();
15751575
}
1576+
1577+
#[cargo_test]
1578+
fn unknown_edge_kind() {
1579+
let p = project()
1580+
.file("Cargo.toml", "")
1581+
.file("src/lib.rs", "")
1582+
.build();
1583+
1584+
p.cargo("tree -e unknown")
1585+
.with_stderr(
1586+
"\
1587+
[ERROR] unknown edge kind `unknown`, valid values are \
1588+
\"normal\", \"build\", \"dev\", \
1589+
\"no-normal\", \"no-build\", \"no-dev\", \"no-proc-macro\", \
1590+
\"features\", or \"all\"
1591+
",
1592+
)
1593+
.with_status(101)
1594+
.run();
1595+
}
1596+
1597+
#[cargo_test]
1598+
fn mixed_no_edge_kinds() {
1599+
let p = project()
1600+
.file(
1601+
"Cargo.toml",
1602+
r#"
1603+
[package]
1604+
name = "foo"
1605+
version = "0.1.0"
1606+
"#,
1607+
)
1608+
.file("src/lib.rs", "")
1609+
.build();
1610+
1611+
p.cargo("tree -e no-build,normal")
1612+
.with_stderr(
1613+
"\
1614+
[ERROR] `normal` dependency kind cannot be mixed with \
1615+
\"no-normal\", \"no-build\", or \"no-dev\" dependency kinds
1616+
",
1617+
)
1618+
.with_status(101)
1619+
.run();
1620+
1621+
// `no-proc-macro` can be mixed with others
1622+
p.cargo("tree -e no-proc-macro,normal")
1623+
.with_stdout(
1624+
"\
1625+
foo v0.1.0 ([..]/foo)
1626+
",
1627+
)
1628+
.run();
1629+
}

0 commit comments

Comments
 (0)