@@ -7,7 +7,7 @@ use snapbox::str;
7
7
use cargo_test_support:: compare:: assert_e2e;
8
8
use cargo_test_support:: registry:: { Package , RegistryBuilder } ;
9
9
use cargo_test_support:: {
10
- basic_bin_manifest, cargo_test, project, symlink_supported, ProjectBuilder ,
10
+ basic_bin_manifest, cargo_process , cargo_test, project, symlink_supported, ProjectBuilder ,
11
11
} ;
12
12
13
13
///////////////////////////////
@@ -400,6 +400,51 @@ bar = "0.1.0"
400
400
assert_e2e ( ) . eq ( contents, lockfile_original) ;
401
401
}
402
402
403
+ #[ cargo_test]
404
+ fn install_respects_lock_file_path ( ) {
405
+ // `cargo install` will imply --locked when lockfile path is provided
406
+ Package :: new ( "bar" , "0.1.0" ) . publish ( ) ;
407
+ Package :: new ( "bar" , "0.1.1" )
408
+ . file ( "src/lib.rs" , "not rust" )
409
+ . publish ( ) ;
410
+ Package :: new ( "foo" , "0.1.0" )
411
+ . dep ( "bar" , "0.1" )
412
+ . file ( "src/lib.rs" , "" )
413
+ . file (
414
+ "src/main.rs" ,
415
+ "extern crate foo; extern crate bar; fn main() {}" ,
416
+ )
417
+ . file (
418
+ "Cargo.lock" ,
419
+ r#"
420
+ [[package]]
421
+ name = "bar"
422
+ version = "0.1.0"
423
+ source = "registry+https://github.com/rust-lang/crates.io-index"
424
+
425
+ [[package]]
426
+ name = "foo"
427
+ version = "0.1.0"
428
+ dependencies = [
429
+ "bar 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
430
+ ]
431
+ "# ,
432
+ )
433
+ . publish ( ) ;
434
+
435
+ cargo_process ( "install foo" )
436
+ . with_stderr_data ( str![ [ r#"
437
+ ...
438
+ [..]not rust[..]
439
+ ...
440
+ "# ] ] )
441
+ . with_status ( 101 )
442
+ . run ( ) ;
443
+ cargo_process ( "install foo -Zunstable-options --lockfile-path lockfile_dir/Cargo.lock" )
444
+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
445
+ . run ( ) ;
446
+ }
447
+
403
448
#[ cargo_test]
404
449
fn run_embed ( ) {
405
450
let lockfile_path = "mylockfile/Cargo.lock" ;
0 commit comments