From 76301ebab9263393de0d8193680cf3f17f95057b Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Thu, 27 Jan 2022 18:09:28 +0800 Subject: [PATCH] Test: install bin `with --path` outside current workspace --- tests/testsuite/install.rs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs index 170f9088e..5442c1884 100644 --- a/tests/testsuite/install.rs +++ b/tests/testsuite/install.rs @@ -530,15 +530,28 @@ fn install_relative_path_outside_current_ws() { .build(); p.cargo("install --path ../bar/foo") + .with_stderr(&format!( + "\ +[INSTALLING] foo v0.0.1 ([..]/bar/foo) +[COMPILING] foo v0.0.1 ([..]/bar/foo) +[FINISHED] release [..] +[INSTALLING] {home}/bin/foo[EXE] +[INSTALLED] package `foo v0.0.1 ([..]/bar/foo)` (executable `foo[EXE]`) +[WARNING] be sure to add [..] +", + home = cargo_home().display(), + )) + .run(); + + // Validate the workspace error message to display available targets. + p.cargo("install --path ../bar/foo --bin") .with_status(101) .with_stderr( "\ -[ERROR] current package believes it's in a workspace when it's not: -current: [CWD]/../bar/foo/Cargo.toml -workspace: [CWD]/Cargo.toml +[ERROR] \"--bin\" takes one argument. +Available binaries: + foo -this may be fixable by adding `../bar/foo` to the `workspace.members` [..] -Alternatively, [..] ", ) .run();