File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -500,6 +500,43 @@ fn install_location_precedence() {
500500 assert_has_installed_exe ( & t4, "foo" ) ;
501501}
502502
503+ #[ cargo_test]
504+ fn relative_install_location ( ) {
505+ let p = project ( ) . file ( "src/main.rs" , "fn main() {}" ) . build ( ) ;
506+
507+ let root = paths:: root ( ) ;
508+ let root_t1 = root. join ( "t1" ) ;
509+ let p_path = p. root ( ) . to_path_buf ( ) ;
510+ let project_t1 = p_path. join ( "t1" ) ;
511+
512+ fs:: create_dir ( root. join ( ".cargo" ) ) . unwrap ( ) ;
513+ fs:: write (
514+ root. join ( ".cargo/config.toml" ) ,
515+ r#"
516+ [install]
517+ root = "t1"
518+ "# ,
519+ )
520+ . unwrap ( ) ;
521+
522+ let mut cmd = cargo_process ( "install --path ." ) ;
523+ cmd. cwd ( p. root ( ) ) ;
524+ cmd. with_stderr_data ( str![ [ r#"
525+ [INSTALLING] foo v0.0.1 ([ROOT]/foo)
526+ [COMPILING] foo v0.0.1 ([ROOT]/foo)
527+ [FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
528+ [INSTALLING] t1/bin/foo
529+ [INSTALLED] package `foo v0.0.1 ([ROOT]/foo)` (executable `foo`)
530+ [WARNING] be sure to add `t1/bin` to your PATH to be able to run the installed binaries
531+
532+ "# ] ] )
533+ . run ( ) ;
534+
535+ // NOTE: the install location is relative to the CWD, not the config file
536+ assert_has_not_installed_exe ( & root_t1, "foo" ) ;
537+ assert_has_installed_exe ( & project_t1, "foo" ) ;
538+ }
539+
503540#[ cargo_test]
504541fn install_path ( ) {
505542 let p = project ( ) . file ( "src/main.rs" , "fn main() {}" ) . build ( ) ;
You can’t perform that action at this time.
0 commit comments