File tree Expand file tree Collapse file tree 1 file changed +93
-0
lines changed Expand file tree Collapse file tree 1 file changed +93
-0
lines changed Original file line number Diff line number Diff line change @@ -1479,3 +1479,96 @@ b v0.1.0 ([..]/foo/b)
1479
1479
)
1480
1480
. run ( ) ;
1481
1481
}
1482
+
1483
+ #[ cargo_test]
1484
+ fn depth_limit ( ) {
1485
+ let p = make_simple_proj ( ) ;
1486
+
1487
+ p. cargo ( "tree --depth 0" )
1488
+ . with_stdout (
1489
+ "\
1490
+ foo v0.1.0 ([..]/foo)
1491
+ [build-dependencies]
1492
+ [dev-dependencies]
1493
+ " ,
1494
+ )
1495
+ . run ( ) ;
1496
+
1497
+ p. cargo ( "tree --depth 1" )
1498
+ . with_stdout (
1499
+ "\
1500
+ foo v0.1.0 ([..]/foo)
1501
+ ├── a v1.0.0
1502
+ └── c v1.0.0
1503
+ [build-dependencies]
1504
+ └── bdep v1.0.0
1505
+ [dev-dependencies]
1506
+ └── devdep v1.0.0
1507
+ " ,
1508
+ )
1509
+ . run ( ) ;
1510
+
1511
+ p. cargo ( "tree --depth 2" )
1512
+ . with_stdout (
1513
+ "\
1514
+ foo v0.1.0 ([..]/foo)
1515
+ ├── a v1.0.0
1516
+ │ └── b v1.0.0
1517
+ └── c v1.0.0
1518
+ [build-dependencies]
1519
+ └── bdep v1.0.0
1520
+ └── b v1.0.0 (*)
1521
+ [dev-dependencies]
1522
+ └── devdep v1.0.0
1523
+ └── b v1.0.0 (*)
1524
+ " ,
1525
+ )
1526
+ . run ( ) ;
1527
+
1528
+ // specify a package
1529
+ p. cargo ( "tree -p bdep --depth 1" )
1530
+ . with_stdout (
1531
+ "\
1532
+ bdep v1.0.0
1533
+ └── b v1.0.0
1534
+ " ,
1535
+ )
1536
+ . run ( ) ;
1537
+
1538
+ // different prefix
1539
+ p. cargo ( "tree --depth 1 --prefix depth" )
1540
+ . with_stdout (
1541
+ "\
1542
+ 0foo v0.1.0 ([..]/foo)
1543
+ 1a v1.0.0
1544
+ 1c v1.0.0
1545
+ 1bdep v1.0.0
1546
+ 1devdep v1.0.0
1547
+ " ,
1548
+ )
1549
+ . run ( ) ;
1550
+
1551
+ // with edge-kinds
1552
+ p. cargo ( "tree --depth 1 -e no-dev" )
1553
+ . with_stdout (
1554
+ "\
1555
+ foo v0.1.0 ([..]/foo)
1556
+ ├── a v1.0.0
1557
+ └── c v1.0.0
1558
+ [build-dependencies]
1559
+ └── bdep v1.0.0
1560
+ " ,
1561
+ )
1562
+ . run ( ) ;
1563
+
1564
+ // invert
1565
+ p. cargo ( "tree --depth 1 --invert c" )
1566
+ . with_stdout (
1567
+ "\
1568
+ c v1.0.0
1569
+ ├── b v1.0.0
1570
+ └── foo v0.1.0 ([..]/foo)
1571
+ " ,
1572
+ )
1573
+ . run ( ) ;
1574
+ }
You can’t perform that action at this time.
0 commit comments