mirror of
https://github.com/rust-lang/cargo
synced 2024-06-30 23:14:41 +00:00
Compare commits
8 Commits
a9ed7376fe
...
e48bd68af0
Author | SHA1 | Date | |
---|---|---|---|
|
e48bd68af0 | ||
|
9441b91186 | ||
|
32cdb261ef | ||
|
ed027736e7 | ||
|
117879b6eb | ||
|
09ba4f33b1 | ||
|
0708802a71 | ||
|
8c6c8a164e |
|
@ -171,7 +171,7 @@ fn add_common_redactions(subs: &mut snapbox::Redactions) {
|
|||
.unwrap();
|
||||
subs.insert(
|
||||
"[FILE_SIZE]",
|
||||
regex!(r"(?<redacted>[0-9]+(\.[0-9]+)([a-zA-Z]i)?)B"),
|
||||
regex!(r"(?<redacted>[0-9]+(\.[0-9]+)?([a-zA-Z]i)?)B\s"),
|
||||
)
|
||||
.unwrap();
|
||||
subs.insert(
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//! Tests for custom cargo commands and other global command features.
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::io::Read;
|
||||
|
@ -12,6 +10,7 @@ use std::str;
|
|||
use cargo_test_support::basic_manifest;
|
||||
use cargo_test_support::paths::CargoPathExt;
|
||||
use cargo_test_support::registry::Package;
|
||||
use cargo_test_support::str;
|
||||
use cargo_test_support::tools::echo_subcommand;
|
||||
use cargo_test_support::{
|
||||
basic_bin_manifest, cargo_exe, cargo_process, paths, project, project_in_home,
|
||||
|
@ -26,25 +25,23 @@ fn path() -> Vec<PathBuf> {
|
|||
fn list_commands_with_descriptions() {
|
||||
let p = project().build();
|
||||
p.cargo("--list")
|
||||
.with_stdout_contains(
|
||||
" build Compile a local package and all of its dependencies",
|
||||
.with_stdout_data(
|
||||
"\
|
||||
...
|
||||
b alias: build
|
||||
...
|
||||
build Compile a local package and all of its dependencies
|
||||
...
|
||||
c alias: check
|
||||
...
|
||||
r alias: run
|
||||
...
|
||||
read-manifest Print a JSON representation of a Cargo.toml manifest.
|
||||
...
|
||||
t alias: test
|
||||
...
|
||||
",
|
||||
)
|
||||
// Assert that `read-manifest` prints the right one-line description followed by another
|
||||
// command, indented.
|
||||
.with_stdout_contains(
|
||||
" read-manifest Print a JSON representation of a Cargo.toml manifest.",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn list_builtin_aliases_with_descriptions() {
|
||||
let p = project().build();
|
||||
p.cargo("--list")
|
||||
.with_stdout_contains(" b alias: build")
|
||||
.with_stdout_contains(" c alias: check")
|
||||
.with_stdout_contains(" r alias: run")
|
||||
.with_stdout_contains(" t alias: test")
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -54,16 +51,20 @@ fn list_custom_aliases_with_descriptions() {
|
|||
.file(
|
||||
&paths::home().join(".cargo").join("config"),
|
||||
r#"
|
||||
[alias]
|
||||
myaliasstr = "foo --bar"
|
||||
myaliasvec = ["foo", "--bar"]
|
||||
"#,
|
||||
[alias]
|
||||
myaliasstr = "foo --bar"
|
||||
myaliasvec = ["foo", "--bar"]
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
|
||||
p.cargo("--list")
|
||||
.with_stdout_contains(" myaliasstr alias: foo --bar")
|
||||
.with_stdout_contains(" myaliasvec alias: foo --bar")
|
||||
.with_stdout_data(str![[r#"
|
||||
...
|
||||
myaliasstr alias: foo --bar
|
||||
myaliasvec alias: foo --bar
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -81,7 +82,11 @@ fn list_dedupe() {
|
|||
|
||||
p.cargo("--list")
|
||||
.env("PATH", &path)
|
||||
.with_stdout_contains_n(" dupe", 1)
|
||||
.with_stdout_data(str![[r#"
|
||||
...
|
||||
dupe
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -132,6 +137,7 @@ fn list_command_looks_at_path_case_mismatch() {
|
|||
);
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn list_command_handles_known_external_commands() {
|
||||
let p = project()
|
||||
|
@ -153,7 +159,10 @@ fn list_command_handles_known_external_commands() {
|
|||
|
||||
p.cargo("--list")
|
||||
.env("PATH", &path)
|
||||
.with_stdout_contains(fmt_desc)
|
||||
.with_stdout_data(str![[r#"
|
||||
...
|
||||
fmt Formats all bin and lib files of the current crate using rustfmt.
|
||||
..."#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -182,13 +191,15 @@ fn list_command_resolves_symlinks() {
|
|||
fn find_closest_capital_c_to_c() {
|
||||
cargo_process("C")
|
||||
.with_status(101)
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
error: no such command: `C`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] no such command: `C`
|
||||
|
||||
<tab>Did you mean `c`?
|
||||
",
|
||||
)
|
||||
Did you mean `c`?
|
||||
|
||||
View all installed commands with `cargo --list`
|
||||
Find a package to install `C` with `cargo search cargo-C`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -196,13 +207,15 @@ error: no such command: `C`
|
|||
fn find_closest_capital_b_to_b() {
|
||||
cargo_process("B")
|
||||
.with_status(101)
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
error: no such command: `B`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] no such command: `B`
|
||||
|
||||
<tab>Did you mean `b`?
|
||||
",
|
||||
)
|
||||
Did you mean `b`?
|
||||
|
||||
View all installed commands with `cargo --list`
|
||||
Find a package to install `B` with `cargo search cargo-B`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -210,13 +223,15 @@ error: no such command: `B`
|
|||
fn find_closest_biuld_to_build() {
|
||||
cargo_process("biuld")
|
||||
.with_status(101)
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
error: no such command: `biuld`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] no such command: `biuld`
|
||||
|
||||
<tab>Did you mean `build`?
|
||||
",
|
||||
)
|
||||
Did you mean `build`?
|
||||
|
||||
View all installed commands with `cargo --list`
|
||||
Find a package to install `biuld` with `cargo search cargo-biuld`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
// But, if we actually have `biuld`, it must work!
|
||||
|
@ -225,22 +240,26 @@ error: no such command: `biuld`
|
|||
.file(
|
||||
"src/main.rs",
|
||||
r#"
|
||||
fn main() {
|
||||
println!("Similar, but not identical to, build");
|
||||
}
|
||||
"#,
|
||||
fn main() {
|
||||
println!("Similar, but not identical to, build");
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.publish();
|
||||
|
||||
cargo_process("install cargo-biuld").run();
|
||||
cargo_process("biuld")
|
||||
.with_stdout("Similar, but not identical to, build\n")
|
||||
.with_stdout_data(str![[r#"
|
||||
Similar, but not identical to, build
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
cargo_process("--list")
|
||||
.with_stdout_contains(
|
||||
" build Compile a local package and all of its dependencies\n",
|
||||
)
|
||||
.with_stdout_contains(" biuld\n")
|
||||
.with_stdout_data(str![[r#"
|
||||
...
|
||||
biuld
|
||||
build Compile a local package and all of its dependencies
|
||||
..."#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -252,37 +271,38 @@ fn find_closest_alias() {
|
|||
fs::write(
|
||||
&my_home.join("config"),
|
||||
r#"
|
||||
[alias]
|
||||
myalias = "build"
|
||||
"#,
|
||||
[alias]
|
||||
myalias = "build"
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
cargo_process("myalais")
|
||||
.env("CARGO_HOME", &my_home)
|
||||
.with_status(101)
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
error: no such command: `myalais`
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] `[ROOT]/my_home/config` is deprecated in favor of `config.toml`
|
||||
[NOTE] if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
|
||||
[ERROR] no such command: `myalais`
|
||||
|
||||
<tab>Did you mean `myalias`?
|
||||
",
|
||||
)
|
||||
Did you mean `myalias`?
|
||||
|
||||
View all installed commands with `cargo --list`
|
||||
Find a package to install `myalais` with `cargo search cargo-myalais`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
// But, if no alias is defined, it must not suggest one!
|
||||
cargo_process("myalais")
|
||||
.with_status(101)
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
error: no such command: `myalais`
|
||||
",
|
||||
)
|
||||
.with_stderr_does_not_contain(
|
||||
"\
|
||||
<tab>Did you mean `myalias`?
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] no such command: `myalais`
|
||||
|
||||
View all installed commands with `cargo --list`
|
||||
Find a package to install `myalais` with `cargo search cargo-myalais`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -290,31 +310,29 @@ error: no such command: `myalais`
|
|||
#[cargo_test]
|
||||
fn find_closest_dont_correct_nonsense() {
|
||||
cargo_process("there-is-no-way-that-there-is-a-command-close-to-this")
|
||||
.cwd(&paths::root())
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
.cwd(&paths::root())
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] no such command: `there-is-no-way-that-there-is-a-command-close-to-this`
|
||||
|
||||
<tab>View all installed commands with `cargo --list`
|
||||
<tab>Find a package to install `there-is-no-way-that-there-is-a-command-close-to-this` with `cargo search cargo-there-is-no-way-that-there-is-a-command-close-to-this`
|
||||
",
|
||||
)
|
||||
.run();
|
||||
View all installed commands with `cargo --list`
|
||||
Find a package to install `there-is-no-way-that-there-is-a-command-close-to-this` with `cargo search cargo-there-is-no-way-that-there-is-a-command-close-to-this`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn displays_subcommand_on_error() {
|
||||
cargo_process("invalid-command")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] no such command: `invalid-command`
|
||||
|
||||
<tab>View all installed commands with `cargo --list`
|
||||
<tab>Find a package to install `invalid-command` with `cargo search cargo-invalid-command`
|
||||
",
|
||||
)
|
||||
View all installed commands with `cargo --list`
|
||||
Find a package to install `invalid-command` with `cargo search cargo-invalid-command`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -326,9 +344,9 @@ fn override_cargo_home() {
|
|||
fs::write(
|
||||
&my_home.join("config"),
|
||||
r#"
|
||||
[cargo-new]
|
||||
vcs = "none"
|
||||
"#,
|
||||
[cargo-new]
|
||||
vcs = "none"
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
@ -341,6 +359,7 @@ fn override_cargo_home() {
|
|||
assert!(paths::root().join("foo2/.git").is_dir());
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn cargo_subcommand_env() {
|
||||
let src = format!(
|
||||
|
@ -424,7 +443,12 @@ fn cargo_cmd_bins_vs_explicit_path() {
|
|||
// If `$CARGO_HOME/bin` is not in a path, prefer it over anything in `$PATH`.
|
||||
//
|
||||
// This is the historical behavior we don't want to break.
|
||||
cargo_process("foo").with_stdout_contains("INSIDE").run();
|
||||
cargo_process("foo")
|
||||
.with_stdout_data(str![[r#"
|
||||
INSIDE
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
// When `$CARGO_HOME/bin` is in the `$PATH`
|
||||
// use only `$PATH` so the user-defined ordering is respected.
|
||||
|
@ -434,7 +458,10 @@ fn cargo_cmd_bins_vs_explicit_path() {
|
|||
"PATH",
|
||||
join_paths(&[&inside_dir, &outside_dir], "PATH").unwrap(),
|
||||
)
|
||||
.with_stdout_contains("INSIDE")
|
||||
.with_stdout_data(str![[r#"
|
||||
INSIDE
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
cargo_process("foo")
|
||||
|
@ -443,7 +470,10 @@ fn cargo_cmd_bins_vs_explicit_path() {
|
|||
"PATH",
|
||||
join_paths(&[inside_dir.join(""), outside_dir.join("")], "PATH").unwrap(),
|
||||
)
|
||||
.with_stdout_contains("INSIDE")
|
||||
.with_stdout_data(str![[r#"
|
||||
INSIDE
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
cargo_process("foo")
|
||||
|
@ -451,7 +481,10 @@ fn cargo_cmd_bins_vs_explicit_path() {
|
|||
"PATH",
|
||||
join_paths(&[&outside_dir, &inside_dir], "PATH").unwrap(),
|
||||
)
|
||||
.with_stdout_contains("OUTSIDE")
|
||||
.with_stdout_data(str![[r#"
|
||||
OUTSIDE
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
cargo_process("foo")
|
||||
|
@ -460,7 +493,10 @@ fn cargo_cmd_bins_vs_explicit_path() {
|
|||
"PATH",
|
||||
join_paths(&[outside_dir.join(""), inside_dir.join("")], "PATH").unwrap(),
|
||||
)
|
||||
.with_stdout_contains("OUTSIDE")
|
||||
.with_stdout_data(str![[r#"
|
||||
OUTSIDE
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
}
|
||||
|
@ -477,16 +513,43 @@ fn cargo_subcommand_args() {
|
|||
|
||||
cargo_process("echo bar -v --help")
|
||||
.env("PATH", &path)
|
||||
.with_stdout("echo bar -v --help")
|
||||
.with_stdout_data(str![[r#"
|
||||
echo bar -v --help
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn explain() {
|
||||
cargo_process("--explain E0001")
|
||||
.with_stdout_contains(
|
||||
"This error suggests that the expression arm corresponding to the noted pattern",
|
||||
)
|
||||
.with_stdout_data(str![[r#"
|
||||
#### Note: this error code is no longer emitted by the compiler.
|
||||
|
||||
This error suggests that the expression arm corresponding to the noted pattern
|
||||
will never be reached as for all possible values of the expression being
|
||||
matched, one of the preceding patterns will match.
|
||||
|
||||
This means that perhaps some of the preceding patterns are too general, this
|
||||
one is too specific or the ordering is incorrect.
|
||||
|
||||
For example, the following `match` block has too many arms:
|
||||
|
||||
```
|
||||
match Some(0) {
|
||||
Some(bar) => {/* ... */}
|
||||
x => {/* ... */} // This handles the `None` case
|
||||
_ => {/* ... */} // All possible cases have already been handled
|
||||
}
|
||||
```
|
||||
|
||||
`match` blocks have their patterns matched in order, so, for example, putting
|
||||
a wildcard arm above a more specific arm will make the latter arm irrelevant.
|
||||
|
||||
Ensure the ordering of the match arm is correct and remove any superfluous
|
||||
arms.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -515,13 +578,13 @@ fn closed_output_ok() {
|
|||
fn subcommand_leading_plus_output_contains() {
|
||||
cargo_process("+nightly")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: no such command: `+nightly`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] no such command: `+nightly`
|
||||
|
||||
<tab>Cargo does not handle `+toolchain` directives.
|
||||
<tab>Did you mean to invoke `cargo` through `rustup` instead?",
|
||||
)
|
||||
Cargo does not handle `+toolchain` directives.
|
||||
Did you mean to invoke `cargo` through `rustup` instead?
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -529,15 +592,14 @@ error: no such command: `+nightly`
|
|||
fn full_did_you_mean() {
|
||||
cargo_process("bluid")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: no such command: `bluid`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] no such command: `bluid`
|
||||
|
||||
<tab>Did you mean `build`?
|
||||
Did you mean `build`?
|
||||
|
||||
<tab>View all installed commands with `cargo --list`
|
||||
<tab>Find a package to install `bluid` with `cargo search cargo-bluid`
|
||||
",
|
||||
)
|
||||
View all installed commands with `cargo --list`
|
||||
Find a package to install `bluid` with `cargo search cargo-bluid`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
//! Tests for `[env]` config.
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use cargo_test_support::basic_manifest;
|
||||
use cargo_test_support::str;
|
||||
use cargo_test_support::{basic_bin_manifest, project};
|
||||
|
||||
#[cargo_test]
|
||||
|
@ -29,8 +28,11 @@ fn env_basic() {
|
|||
.build();
|
||||
|
||||
p.cargo("run")
|
||||
.with_stdout_contains("compile-time:Hello")
|
||||
.with_stdout_contains("run-time:Hello")
|
||||
.with_stdout_data(str![[r#"
|
||||
compile-time:Hello
|
||||
run-time:Hello
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -56,7 +58,16 @@ fn env_invalid() {
|
|||
|
||||
p.cargo("check")
|
||||
.with_status(101)
|
||||
.with_stderr_contains("[..]could not load config key `env.ENV_TEST_BOOL`")
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `env.ENV_TEST_BOOL`
|
||||
|
||||
Caused by:
|
||||
error in [ROOT]/foo/.cargo/config.toml: could not load config key `env.ENV_TEST_BOOL`
|
||||
|
||||
Caused by:
|
||||
invalid type: boolean `false`, expected a string or map
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -80,9 +91,11 @@ fn env_no_disallowed() {
|
|||
);
|
||||
p.cargo("check")
|
||||
.with_status(101)
|
||||
.with_stderr(&format!(
|
||||
"[ERROR] setting the `{disallowed}` environment variable \
|
||||
is not supported in the `[env]` configuration table"
|
||||
.with_stderr_data(format!(
|
||||
"\
|
||||
[ERROR] setting the `{disallowed}` environment variable \
|
||||
is not supported in the `[env]` configuration table
|
||||
"
|
||||
))
|
||||
.run();
|
||||
}
|
||||
|
@ -118,9 +131,12 @@ fn env_force() {
|
|||
.env("ENV_TEST_FORCED", "from-env")
|
||||
.env("ENV_TEST_UNFORCED", "from-env")
|
||||
.env("ENV_TEST_UNFORCED_DEFAULT", "from-env")
|
||||
.with_stdout_contains("ENV_TEST_FORCED:from-config")
|
||||
.with_stdout_contains("ENV_TEST_UNFORCED:from-env")
|
||||
.with_stdout_contains("ENV_TEST_UNFORCED_DEFAULT:from-env")
|
||||
.with_stdout_data(str![[r#"
|
||||
ENV_TEST_FORCED:from-config
|
||||
ENV_TEST_UNFORCED:from-env
|
||||
ENV_TEST_UNFORCED_DEFAULT:from-env
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -181,7 +197,10 @@ fn env_no_override() {
|
|||
.build();
|
||||
|
||||
p.cargo("run")
|
||||
.with_stdout_contains("CARGO_PKG_NAME:unchanged")
|
||||
.with_stdout_data(str![[r#"
|
||||
CARGO_PKG_NAME:unchanged
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -231,8 +250,14 @@ fn env_applied_to_target_info_discovery_rustc() {
|
|||
|
||||
p.cargo("run")
|
||||
.env("RUSTC_WORKSPACE_WRAPPER", wrapper)
|
||||
.with_stderr_contains("WRAPPER ENV_TEST:from-config")
|
||||
.with_stderr_contains("MAIN ENV_TEST:from-config")
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.5.0 ([ROOT]/foo)
|
||||
WRAPPER ENV_TEST:from-config
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[RUNNING] `target/debug/foo[EXE]`
|
||||
MAIN ENV_TEST:from-config
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
// Ensure wrapper also maintains the same overridden priority for envs.
|
||||
|
@ -240,7 +265,13 @@ fn env_applied_to_target_info_discovery_rustc() {
|
|||
p.cargo("run")
|
||||
.env("ENV_TEST", "from-env")
|
||||
.env("RUSTC_WORKSPACE_WRAPPER", wrapper)
|
||||
.with_stderr_contains("WRAPPER ENV_TEST:from-env")
|
||||
.with_stderr_contains("MAIN ENV_TEST:from-env")
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.5.0 ([ROOT]/foo)
|
||||
WRAPPER ENV_TEST:from-env
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[RUNNING] `target/debug/foo[EXE]`
|
||||
MAIN ENV_TEST:from-env
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
//! Tests for `cargo-features` definitions.
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use cargo_test_support::registry::Package;
|
||||
use cargo_test_support::str;
|
||||
use cargo_test_support::{project, registry};
|
||||
|
||||
#[cargo_test]
|
||||
|
@ -24,9 +23,8 @@ fn feature_required() {
|
|||
p.cargo("check")
|
||||
.masquerade_as_nightly_cargo(&["test-dummy-unstable"])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[..]`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
the `im-a-teapot` manifest key is unstable and may not work properly in England
|
||||
|
@ -34,22 +32,18 @@ Caused by:
|
|||
Caused by:
|
||||
feature `test-dummy-unstable` is required
|
||||
|
||||
The package requires the Cargo feature called `test-dummy-unstable`, \
|
||||
but that feature is not stabilized in this version of Cargo (1.[..]).
|
||||
Consider adding `cargo-features = [\"test-dummy-unstable\"]` to the top of Cargo.toml \
|
||||
(above the [package] table) to tell Cargo you are opting in to use this unstable feature.
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information \
|
||||
about the status of this feature.
|
||||
",
|
||||
)
|
||||
The package requires the Cargo feature called `test-dummy-unstable`, but that feature is not stabilized in this version of Cargo (1.[..]).
|
||||
Consider adding `cargo-features = ["test-dummy-unstable"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature.
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about the status of this feature.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
// Same, but stable.
|
||||
p.cargo("check")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[..]`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
the `im-a-teapot` manifest key is unstable and may not work properly in England
|
||||
|
@ -57,13 +51,11 @@ Caused by:
|
|||
Caused by:
|
||||
feature `test-dummy-unstable` is required
|
||||
|
||||
The package requires the Cargo feature called `test-dummy-unstable`, \
|
||||
but that feature is not stabilized in this version of Cargo (1.[..]).
|
||||
The package requires the Cargo feature called `test-dummy-unstable`, but that feature is not stabilized in this version of Cargo (1.[..]).
|
||||
Consider trying a newer version of Cargo (this may require the nightly release).
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html \
|
||||
for more information about the status of this feature.
|
||||
",
|
||||
)
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about the status of this feature.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -105,16 +97,15 @@ fn feature_required_dependency() {
|
|||
p.cargo("check")
|
||||
.masquerade_as_nightly_cargo(&["test-dummy-unstable"])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
[UPDATING] [..]
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] `dummy-registry` index
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[DOWNLOADING] [..]
|
||||
[DOWNLOADED] bar v1.0.0 [..]
|
||||
error: failed to download replaced source registry `crates-io`
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
|
||||
[ERROR] failed to download replaced source registry `crates-io`
|
||||
|
||||
Caused by:
|
||||
failed to parse manifest at `[..]/bar-1.0.0/Cargo.toml`
|
||||
failed to parse manifest at `[ROOT]/home/.cargo/registry/src/-[HASH]/bar-1.0.0/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
the `im-a-teapot` manifest key is unstable and may not work properly in England
|
||||
|
@ -122,21 +113,18 @@ Caused by:
|
|||
Caused by:
|
||||
feature `test-dummy-unstable` is required
|
||||
|
||||
The package requires the Cargo feature called `test-dummy-unstable`, \
|
||||
but that feature is not stabilized in this version of Cargo (1.[..]).
|
||||
The package requires the Cargo feature called `test-dummy-unstable`, but that feature is not stabilized in this version of Cargo (1.[..]).
|
||||
Consider trying a more recent nightly release.
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html \
|
||||
for more information about the status of this feature.
|
||||
",
|
||||
)
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about the status of this feature.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
// Same, but stable.
|
||||
p.cargo("check")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to download `bar v1.0.0`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to download `bar v1.0.0`
|
||||
|
||||
Caused by:
|
||||
unable to get packages from source
|
||||
|
@ -145,7 +133,7 @@ Caused by:
|
|||
failed to download replaced source registry `crates-io`
|
||||
|
||||
Caused by:
|
||||
failed to parse manifest at `[..]/bar-1.0.0/Cargo.toml`
|
||||
failed to parse manifest at `[ROOT]/home/.cargo/registry/src/-[HASH]/bar-1.0.0/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
the `im-a-teapot` manifest key is unstable and may not work properly in England
|
||||
|
@ -153,13 +141,11 @@ Caused by:
|
|||
Caused by:
|
||||
feature `test-dummy-unstable` is required
|
||||
|
||||
The package requires the Cargo feature called `test-dummy-unstable`, \
|
||||
but that feature is not stabilized in this version of Cargo (1.[..]).
|
||||
The package requires the Cargo feature called `test-dummy-unstable`, but that feature is not stabilized in this version of Cargo (1.[..]).
|
||||
Consider trying a newer version of Cargo (this may require the nightly release).
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html \
|
||||
for more information about the status of this feature.
|
||||
",
|
||||
)
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about the status of this feature.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -182,14 +168,13 @@ fn unknown_feature() {
|
|||
.build();
|
||||
p.cargo("check")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[..]`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
unknown cargo feature `foo`
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -211,15 +196,13 @@ fn stable_feature_warns() {
|
|||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
p.cargo("check")
|
||||
.with_stderr(
|
||||
"\
|
||||
warning: the cargo feature `test-dummy-stable` has been stabilized in the 1.0 \
|
||||
release and is no longer necessary to be listed in the manifest
|
||||
See https://doc.rust-lang.org/[..]cargo/ for more information about using this feature.
|
||||
[CHECKING] a [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] the cargo feature `test-dummy-stable` has been stabilized in the 1.0 release and is no longer necessary to be listed in the manifest
|
||||
See https://doc.rust-lang.org/cargo/ for more information about using this feature.
|
||||
[CHECKING] a v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -244,12 +227,11 @@ fn allow_features() {
|
|||
|
||||
p.cargo("-Zallow-features=test-dummy-unstable check")
|
||||
.masquerade_as_nightly_cargo(&["allow-features", "test-dummy-unstable"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[CHECKING] a [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[CHECKING] a v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("-Zallow-features=test-dummy-unstable,print-im-a-teapot -Zprint-im-a-teapot check")
|
||||
|
@ -258,7 +240,10 @@ fn allow_features() {
|
|||
"test-dummy-unstable",
|
||||
"print-im-a-teapot",
|
||||
])
|
||||
.with_stdout("im-a-teapot = true")
|
||||
.with_stdout_data(str![[r#"
|
||||
im-a-teapot = true
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("-Zallow-features=test-dummy-unstable -Zprint-im-a-teapot check")
|
||||
|
@ -268,24 +253,22 @@ fn allow_features() {
|
|||
"print-im-a-teapot",
|
||||
])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: the feature `print-im-a-teapot` is not in the list of allowed features: [test-dummy-unstable]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the feature `print-im-a-teapot` is not in the list of allowed features: [test-dummy-unstable]
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("-Zallow-features= check")
|
||||
.masquerade_as_nightly_cargo(&["allow-features", "test-dummy-unstable"])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[..]`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
the feature `test-dummy-unstable` is not in the list of allowed features: []
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -314,17 +297,20 @@ fn allow_features_to_rustc() {
|
|||
p.cargo("-Zallow-features= check")
|
||||
.masquerade_as_nightly_cargo(&["allow-features"])
|
||||
.with_status(101)
|
||||
.with_stderr_contains("[..]E0725[..]")
|
||||
.with_stderr_data(str![[r#"
|
||||
[CHECKING] a v0.0.1 ([ROOT]/foo)
|
||||
error[E0725]: the feature `rustc_attrs` is not in the list of allowed features
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("-Zallow-features=rustc_attrs check")
|
||||
.masquerade_as_nightly_cargo(&["allow-features"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[CHECKING] a [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[CHECKING] a v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -360,12 +346,11 @@ fn allow_features_in_cfg() {
|
|||
"test-dummy-unstable",
|
||||
"print-im-a-teapot",
|
||||
])
|
||||
.with_stderr(
|
||||
"\
|
||||
[CHECKING] a [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[CHECKING] a v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("-Zprint-im-a-teapot check")
|
||||
|
@ -374,18 +359,23 @@ fn allow_features_in_cfg() {
|
|||
"test-dummy-unstable",
|
||||
"print-im-a-teapot",
|
||||
])
|
||||
.with_stdout("im-a-teapot = true")
|
||||
.with_stderr("[FINISHED] [..]")
|
||||
.with_stdout_data(str![[r#"
|
||||
im-a-teapot = true
|
||||
|
||||
"#]])
|
||||
.with_stderr_data(str![[r#"
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("-Zunstable-options check")
|
||||
.masquerade_as_nightly_cargo(&["allow-features", "test-dummy-unstable", "print-im-a-teapot"])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: the feature `unstable-options` is not in the list of allowed features: [print-im-a-teapot, test-dummy-unstable]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the feature `unstable-options` is not in the list of allowed features: [print-im-a-teapot, test-dummy-unstable]
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
// -Zallow-features overrides .cargo/config.toml
|
||||
|
@ -396,11 +386,10 @@ error: the feature `unstable-options` is not in the list of allowed features: [p
|
|||
"print-im-a-teapot",
|
||||
])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: the feature `print-im-a-teapot` is not in the list of allowed features: [test-dummy-unstable]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the feature `print-im-a-teapot` is not in the list of allowed features: [test-dummy-unstable]
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("-Zallow-features= check")
|
||||
|
@ -410,14 +399,13 @@ error: the feature `print-im-a-teapot` is not in the list of allowed features: [
|
|||
"print-im-a-teapot",
|
||||
])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[..]`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
the feature `test-dummy-unstable` is not in the list of allowed features: []
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -441,28 +429,22 @@ fn nightly_feature_requires_nightly() {
|
|||
.build();
|
||||
p.cargo("check")
|
||||
.masquerade_as_nightly_cargo(&["test-dummy-unstable"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[CHECKING] a [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[CHECKING] a v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("check")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[..]`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
the cargo feature `test-dummy-unstable` requires a nightly version of Cargo, \
|
||||
but this is the `stable` channel
|
||||
See [..]
|
||||
See https://doc.rust-lang.org/[..]cargo/reference/unstable.html for more \
|
||||
information about using this feature.
|
||||
",
|
||||
)
|
||||
the cargo feature `test-dummy-unstable` requires a nightly version of Cargo, but this is the `stable` channel
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -500,39 +482,33 @@ fn nightly_feature_requires_nightly_in_dep() {
|
|||
.build();
|
||||
p.cargo("check")
|
||||
.masquerade_as_nightly_cargo(&["test-dummy-unstable"])
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[CHECKING] a [..]
|
||||
[CHECKING] b [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
[CHECKING] a v0.0.1 ([ROOT]/foo/a)
|
||||
[CHECKING] b v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("check")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
[ERROR] failed to get `a` as a dependency of package `b v0.0.1 ([..])`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to get `a` as a dependency of package `b v0.0.1 ([ROOT]/foo)`
|
||||
|
||||
Caused by:
|
||||
failed to load source for dependency `a`
|
||||
|
||||
Caused by:
|
||||
Unable to update [..]
|
||||
Unable to update [ROOT]/foo/a
|
||||
|
||||
Caused by:
|
||||
failed to parse manifest at `[..]`
|
||||
failed to parse manifest at `[ROOT]/foo/a/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
the cargo feature `test-dummy-unstable` requires a nightly version of Cargo, \
|
||||
but this is the `stable` channel
|
||||
See [..]
|
||||
See https://doc.rust-lang.org/[..]cargo/reference/unstable.html for more \
|
||||
information about using this feature.
|
||||
",
|
||||
)
|
||||
the cargo feature `test-dummy-unstable` requires a nightly version of Cargo, but this is the `stable` channel
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -556,28 +532,23 @@ fn cant_publish() {
|
|||
.build();
|
||||
p.cargo("check")
|
||||
.masquerade_as_nightly_cargo(&["test-dummy-unstable"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[CHECKING] a [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[CHECKING] a v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("check")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[..]`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
the cargo feature `test-dummy-unstable` requires a nightly version of Cargo, \
|
||||
but this is the `stable` channel
|
||||
See [..]
|
||||
See https://doc.rust-lang.org/[..]cargo/reference/unstable.html for more \
|
||||
information about using this feature.
|
||||
",
|
||||
)
|
||||
the cargo feature `test-dummy-unstable` requires a nightly version of Cargo, but this is the `stable` channel
|
||||
...
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -601,34 +572,36 @@ fn z_flags_rejected() {
|
|||
.build();
|
||||
p.cargo("check -Zprint-im-a-teapot")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"error: the `-Z` flag is only accepted on the nightly \
|
||||
channel of Cargo, but this is the `stable` channel\n\
|
||||
See [..]",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel
|
||||
See [..]
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("check -Zarg")
|
||||
.masquerade_as_nightly_cargo(&["test-dummy-unstable"])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
r#"error: unknown `-Z` flag specified: arg
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] unknown `-Z` flag specified: arg
|
||||
|
||||
For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
|
||||
If you intended to use an unstable rustc feature, try setting `RUSTFLAGS="-Zarg"`
|
||||
"#,
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("check -Zprint-im-a-teapot")
|
||||
.masquerade_as_nightly_cargo(&["test-dummy-unstable"])
|
||||
.with_stdout("im-a-teapot = true\n")
|
||||
.with_stderr(
|
||||
"\
|
||||
[CHECKING] a [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stdout_data(str![[r#"
|
||||
im-a-teapot = true
|
||||
|
||||
"#]])
|
||||
.with_stderr_data(str![[r#"
|
||||
[CHECKING] a v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -658,23 +631,22 @@ fn publish_allowed() {
|
|||
p.cargo("publish")
|
||||
.replace_crates_io(registry.index_url())
|
||||
.masquerade_as_nightly_cargo(&["test-dummy-unstable"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[UPDATING] [..]
|
||||
[WARNING] [..]
|
||||
[..]
|
||||
[PACKAGING] a v0.0.1 [..]
|
||||
[PACKAGED] [..]
|
||||
[VERIFYING] a v0.0.1 [..]
|
||||
[COMPILING] a v0.0.1 [..]
|
||||
[FINISHED] [..]
|
||||
[UPLOADING] a v0.0.1 [..]
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] crates.io index
|
||||
[WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
|
||||
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
|
||||
[PACKAGING] a v0.0.1 ([ROOT]/foo)
|
||||
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
|
||||
[VERIFYING] a v0.0.1 ([ROOT]/foo)
|
||||
[COMPILING] a v0.0.1 ([ROOT]/foo/target/package/a-0.0.1)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[UPLOADING] a v0.0.1 ([ROOT]/foo)
|
||||
[UPLOADED] a v0.0.1 to registry `crates-io`
|
||||
[NOTE] waiting for `a v0.0.1` to be available at registry `crates-io`.
|
||||
You may press ctrl-c to skip waiting; the crate should be available shortly.
|
||||
[PUBLISHED] a v0.0.1 at registry `crates-io`
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -696,16 +668,15 @@ fn wrong_position() {
|
|||
p.cargo("check")
|
||||
.masquerade_as_nightly_cargo(&["test-dummy-unstable"])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the field `cargo-features` should be set at the top of Cargo.toml before any tables
|
||||
--> Cargo.toml:6:34
|
||||
|
|
||||
6 | cargo-features = [\"test-dummy-unstable\"]
|
||||
6 | cargo-features = ["test-dummy-unstable"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -715,27 +686,24 @@ fn z_stabilized() {
|
|||
|
||||
p.cargo("check -Z cache-messages")
|
||||
.masquerade_as_nightly_cargo(&["always_nightly"])
|
||||
.with_stderr(
|
||||
"\
|
||||
warning: flag `-Z cache-messages` has been stabilized in the 1.40 release, \
|
||||
and is no longer necessary
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] flag `-Z cache-messages` has been stabilized in the 1.40 release, and is no longer necessary
|
||||
Message caching is now always enabled.
|
||||
|
||||
[CHECKING] foo [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("check -Z offline")
|
||||
.masquerade_as_nightly_cargo(&["always_nightly"])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: flag `-Z offline` has been stabilized in the 1.36 release
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] flag `-Z offline` has been stabilized in the 1.36 release
|
||||
Offline mode is now available via the --offline CLI option
|
||||
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
//! Tests specifically related to target handling (lib, bins, examples, tests, benches).
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use cargo_test_support::project;
|
||||
use cargo_test_support::str;
|
||||
|
||||
#[cargo_test]
|
||||
fn warn_unmatched_target_filters() {
|
||||
|
@ -24,13 +23,11 @@ fn warn_unmatched_target_filters() {
|
|||
.build();
|
||||
|
||||
p.cargo("check --tests --bins --examples --benches")
|
||||
.with_stderr(
|
||||
"\
|
||||
[WARNING] target filters `bins`, `tests`, `examples`, `benches` specified, \
|
||||
but no targets matched; this is a no-op
|
||||
[FINISHED][..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] target filters `bins`, `tests`, `examples`, `benches` specified, but no targets matched; this is a no-op
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -55,18 +52,20 @@ fn reserved_windows_target_name() {
|
|||
|
||||
if cfg!(windows) {
|
||||
p.cargo("check")
|
||||
.with_stderr(
|
||||
"\
|
||||
[WARNING] binary target `con` is a reserved Windows filename, \
|
||||
this target will not work on Windows platforms
|
||||
[CHECKING] foo[..]
|
||||
[FINISHED][..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] binary target `con` is a reserved Windows filename, this target will not work on Windows platforms
|
||||
[CHECKING] foo v0.1.0 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
} else {
|
||||
p.cargo("check")
|
||||
.with_stderr("[CHECKING] foo[..]\n[FINISHED][..]")
|
||||
.with_stderr_data(str![[r#"
|
||||
[CHECKING] foo v0.1.0 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user