Skip to content

Commit b141907

Browse files
committed
test: add a case with trailing slash
1 parent cb65d9c commit b141907

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/testsuite/install.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,42 @@ fn relative_install_location_without_trailing_slash() {
537537
assert_has_installed_exe(&project_t1, "foo");
538538
}
539539

540+
#[cargo_test]
541+
fn relative_install_location_with_trailing_slash() {
542+
let p = project().file("src/main.rs", "fn main() {}").build();
543+
544+
let root = paths::root();
545+
let root_t1 = root.join("t1");
546+
let p_path = p.root().to_path_buf();
547+
let project_t1 = p_path.join("t1");
548+
549+
fs::create_dir(root.join(".cargo")).unwrap();
550+
fs::write(
551+
root.join(".cargo/config.toml"),
552+
r#"
553+
[install]
554+
root = "t1/"
555+
"#,
556+
)
557+
.unwrap();
558+
559+
let mut cmd = cargo_process("install --path .");
560+
cmd.cwd(p.root());
561+
cmd.with_stderr_data(str![[r#"
562+
[INSTALLING] foo v0.0.1 ([ROOT]/foo)
563+
[COMPILING] foo v0.0.1 ([ROOT]/foo)
564+
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
565+
[INSTALLING] [ROOT]/t1/bin/foo[EXE]
566+
[INSTALLED] package `foo v0.0.1 ([ROOT]/foo)` (executable `foo[EXE]`)
567+
[WARNING] be sure to add `[ROOT]/t1/bin` to your PATH to be able to run the installed binaries
568+
569+
"#]])
570+
.run();
571+
572+
assert_has_installed_exe(&root_t1, "foo");
573+
assert_has_not_installed_exe(&project_t1, "foo");
574+
}
575+
540576
#[cargo_test]
541577
fn install_path() {
542578
let p = project().file("src/main.rs", "fn main() {}").build();

0 commit comments

Comments
 (0)