@@ -1128,7 +1128,9 @@ foo v0.1.0 ([ROOT]/foo)
11281128#[ cargo_test]
11291129fn format ( ) {
11301130 Package :: new ( "dep" , "1.0.0" ) . publish ( ) ;
1131- Package :: new ( "other-dep" , "1.0.0" ) . publish ( ) ;
1131+ Package :: new ( "other-dep" , "1.0.0" )
1132+ . dep ( "dep" , "^1.0" )
1133+ . publish ( ) ;
11321134
11331135 Package :: new ( "dep_that_is_awesome" , "1.0.0" )
11341136 . file (
@@ -1140,6 +1142,9 @@ fn format() {
11401142
11411143 [lib]
11421144 name = "awesome_dep"
1145+
1146+ [dependencies]
1147+ dep = {version="<2.0"}
11431148 "# ,
11441149 )
11451150 . file ( "src/lib.rs" , "pub struct Straw;" )
@@ -1156,9 +1161,9 @@ fn format() {
11561161 repository = "https://github.com/rust-lang/cargo"
11571162
11581163 [dependencies]
1159- dep = {version="1.0", optional=true }
1164+ dep = {version="= 1.0"}
11601165 other-dep = {version="1.0", optional=true}
1161- dep_that_is_awesome = {version="1.0", optional=true}
1166+ dep_that_is_awesome = {version=">= 1.0, <2 ", optional=true}
11621167
11631168
11641169 [features]
@@ -1173,6 +1178,7 @@ fn format() {
11731178 p. cargo ( "tree --format <<<{p}>>>" )
11741179 . with_stdout_data ( str![ [ r#"
11751180<<<foo v0.1.0 ([ROOT]/foo)>>>
1181+ └── <<<dep v1.0.0>>>
11761182
11771183"# ] ] )
11781184 . run ( ) ;
@@ -1191,6 +1197,7 @@ Caused by:
11911197 p. cargo ( "tree --format {p}-{{hello}}" )
11921198 . with_stdout_data ( str![ [ r#"
11931199foo v0.1.0 ([ROOT]/foo)-{hello}
1200+ └── dep v1.0.0-{hello}
11941201
11951202"# ] ] )
11961203 . run ( ) ;
@@ -1199,6 +1206,7 @@ foo v0.1.0 ([ROOT]/foo)-{hello}
11991206 . arg ( "{p} {l} {r}" )
12001207 . with_stdout_data ( str![ [ r#"
12011208foo v0.1.0 ([ROOT]/foo) MIT https://github.com/rust-lang/cargo
1209+ └── dep v1.0.0
12021210
12031211"# ] ] )
12041212 . run ( ) ;
@@ -1207,17 +1215,19 @@ foo v0.1.0 ([ROOT]/foo) MIT https://github.com/rust-lang/cargo
12071215 . arg ( "{p} {f}" )
12081216 . with_stdout_data ( str![ [ r#"
12091217foo v0.1.0 ([ROOT]/foo) bar,default,foo
1218+ └── dep v1.0.0
12101219
12111220"# ] ] )
12121221 . run ( ) ;
12131222
12141223 p. cargo ( "tree --all-features --format" )
12151224 . arg ( "{p} [{f}]" )
12161225 . with_stdout_data ( str![ [ r#"
1217- foo v0.1.0 ([ROOT]/foo) [bar,default,dep, dep_that_is_awesome,foo,other-dep]
1226+ foo v0.1.0 ([ROOT]/foo) [bar,default,dep_that_is_awesome,foo,other-dep]
12181227├── dep v1.0.0 []
12191228├── dep_that_is_awesome v1.0.0 []
12201229└── other-dep v1.0.0 []
1230+ └── dep v1.0.0 []
12211231
12221232"# ] ] )
12231233 . run ( ) ;
@@ -1227,8 +1237,34 @@ foo v0.1.0 ([ROOT]/foo) [bar,default,dep,dep_that_is_awesome,foo,other-dep]
12271237 . arg ( "--format={lib}" )
12281238 . with_stdout_data ( str![ [ r#"
12291239
1240+ ├── dep
12301241├── awesome_dep
12311242└── other_dep
1243+ └── dep
1244+
1245+ "# ] ] )
1246+ . run ( ) ;
1247+
1248+ p. cargo ( "tree --all-features" )
1249+ . arg ( "--format={p}" )
1250+ . with_stdout_data ( str![ [ r#"
1251+ foo v0.1.0 ([ROOT]/foo)
1252+ ├── dep v1.0.0
1253+ ├── dep_that_is_awesome v1.0.0
1254+ └── other-dep v1.0.0
1255+ └── dep v1.0.0
1256+
1257+ "# ] ] )
1258+ . run ( ) ;
1259+
1260+ p. cargo ( "tree --all-features" )
1261+ . arg ( "--format={p}" )
1262+ . arg ( "--invert=dep" )
1263+ . with_stdout_data ( str![ [ r#"
1264+ dep v1.0.0
1265+ ├── foo v0.1.0 ([ROOT]/foo)
1266+ └── other-dep v1.0.0
1267+ └── foo v0.1.0 ([ROOT]/foo)
12321268
12331269"# ] ] )
12341270 . run ( ) ;
0 commit comments