mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Add initial version of hints tests, to show pre-[hints]
Cargo behavior
These tests show what prior versions of Cargo will do with hints. The subsequent addition of support for hints will modify these tests to reflect the corresponding changes to Cargo.
This commit is contained in:
parent
8fd9309102
commit
a206766e43
59
tests/testsuite/hints.rs
Normal file
59
tests/testsuite/hints.rs
Normal file
@ -0,0 +1,59 @@
|
||||
//! Tests for hints.
|
||||
|
||||
use crate::prelude::*;
|
||||
use cargo_test_support::{project, str};
|
||||
|
||||
#[cargo_test]
|
||||
fn empty_hints_warn() {
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
edition = "2015"
|
||||
|
||||
[hints]
|
||||
"#,
|
||||
)
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
p.cargo("check -v")
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] unused manifest key: hints
|
||||
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn unknown_hints_warn() {
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
edition = "2015"
|
||||
|
||||
[hints]
|
||||
this-is-an-unknown-hint = true
|
||||
"#,
|
||||
)
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
p.cargo("check -v")
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] unused manifest key: hints
|
||||
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
@ -106,6 +106,7 @@ mod git_shallow;
|
||||
mod glob_targets;
|
||||
mod global_cache_tracker;
|
||||
mod help;
|
||||
mod hints;
|
||||
mod https;
|
||||
mod inheritable_workspace_fields;
|
||||
mod install;
|
||||
|
Loading…
x
Reference in New Issue
Block a user