@@ -7,7 +7,8 @@ use snapbox::str;
77use cargo_test_support:: compare:: assert_e2e;
88use cargo_test_support:: registry:: { Package , RegistryBuilder } ;
99use 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 ,
1112} ;
1213
1314///////////////////////////////
@@ -400,6 +401,51 @@ bar = "0.1.0"
400401 assert_e2e ( ) . eq ( contents, lockfile_original) ;
401402}
402403
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+
403449#[ cargo_test]
404450fn run_embed ( ) {
405451 let lockfile_path = "mylockfile/Cargo.lock" ;
0 commit comments