File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -816,7 +816,7 @@ impl<'a> RegistryQueryer<'a> {
816816 // Higher version ordered first.
817817 cmp. reverse ( )
818818 }
819- } ,
819+ }
820820 _ => previous_cmp,
821821 }
822822 } ) ;
Original file line number Diff line number Diff line change @@ -250,3 +250,38 @@ fn cargo_update_generate_lockfile() {
250250 assert_that ( p. cargo ( "update" ) , execs ( ) . with_status ( 0 ) . with_stdout ( "" ) ) ;
251251 assert_that ( & lockfile, existing_file ( ) ) ;
252252}
253+
254+ // Ensure that the "-Z minimal-versions" CLI option works and the minimal
255+ // version of a dependency ends up in the lock file.
256+ #[ test]
257+ fn install_minimal_version ( ) {
258+ Package :: new ( "dep" , "1.0.0" ) . publish ( ) ;
259+ Package :: new ( "dep" , "1.1.0" ) . publish ( ) ;
260+
261+ let p = project ( "foo" )
262+ . file (
263+ "Cargo.toml" ,
264+ r#"
265+ [package]
266+ name = "foo"
267+ authors = []
268+ version = "0.0.1"
269+
270+ [dependencies]
271+ dep = "1.0"
272+ "# ,
273+ )
274+ . file ( "src/main.rs" , "fn main() {}" )
275+ . build ( ) ;
276+
277+ assert_that (
278+ p. cargo ( "generate-lockfile" )
279+ . masquerade_as_nightly_cargo ( )
280+ . arg ( "-Zminimal-versions" ) ,
281+ execs ( ) . with_status ( 0 ) ,
282+ ) ;
283+
284+ let lock = p. read_lockfile ( ) ;
285+
286+ assert ! ( lock. contains( "dep 1.0.0" ) ) ;
287+ }
You can’t perform that action at this time.
0 commit comments