@@ -7,7 +7,8 @@ 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, paths, project, symlink_supported,
11
+ ProjectBuilder ,
11
12
} ;
12
13
13
14
///////////////////////////////
@@ -400,6 +401,51 @@ bar = "0.1.0"
400
401
assert_e2e ( ) . eq ( contents, lockfile_original) ;
401
402
}
402
403
404
+ #[ cargo_test]
405
+ fn install_without_lockfile_path ( ) {
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 --locked" ) . run ( ) ;
444
+ assert ! ( paths:: root( )
445
+ . join( "home/.cargo/registry/src/-ec6bec4300fe98b6/foo-0.1.0/Cargo.lock" )
446
+ . is_file( ) ) ;
447
+ }
448
+
403
449
#[ cargo_test]
404
450
fn run_embed ( ) {
405
451
let lockfile_path = "mylockfile/Cargo.lock" ;
0 commit comments