Skip to content

Commit 1c0f6cf

Browse files
committed
test(tree): new incomplete test for cargo tree --depth workspace
1 parent 4412b0a commit 1c0f6cf

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

tests/testsuite/tree.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,64 @@ c v1.0.0
18461846
.run();
18471847
}
18481848

1849+
#[cargo_test]
1850+
fn depth_workspace() {
1851+
Package::new("somedep", "1.0.0").publish();
1852+
Package::new("otherdep", "1.0.0").publish();
1853+
let p = project()
1854+
.file(
1855+
"Cargo.toml",
1856+
r#"
1857+
[workspace]
1858+
members = ["a", "b", "c"]
1859+
"#,
1860+
)
1861+
.file("a/Cargo.toml", &basic_manifest("a", "1.0.0"))
1862+
.file("a/src/lib.rs", "")
1863+
.file(
1864+
"b/Cargo.toml",
1865+
r#"
1866+
[package]
1867+
name = "b"
1868+
version = "0.1.0"
1869+
1870+
[dependencies]
1871+
c = { path = "../c" }
1872+
somedep = "1"
1873+
"#,
1874+
)
1875+
.file("b/src/lib.rs", "")
1876+
.file(
1877+
"c/Cargo.toml",
1878+
r#"
1879+
[package]
1880+
name = "c"
1881+
version = "0.1.0"
1882+
1883+
[dependencies]
1884+
somedep = "1"
1885+
otherdep = "1"
1886+
"#,
1887+
)
1888+
.file("c/src/lib.rs", "")
1889+
.build();
1890+
1891+
p.cargo("tree")
1892+
.with_stdout_data(str![[r#"
1893+
a v1.0.0 ([ROOT]/foo/a)
1894+
1895+
b v0.1.0 ([ROOT]/foo/b)
1896+
├── c v0.1.0 ([ROOT]/foo/c)
1897+
│ ├── otherdep v1.0.0
1898+
│ └── somedep v1.0.0
1899+
└── somedep v1.0.0
1900+
1901+
c v0.1.0 ([ROOT]/foo/c) (*)
1902+
1903+
"#]])
1904+
.run();
1905+
}
1906+
18491907
#[cargo_test]
18501908
fn prune() {
18511909
let p = make_simple_proj();

0 commit comments

Comments
 (0)