Skip to content

Commit a206766

Browse files
committed
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.
1 parent 8fd9309 commit a206766

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

tests/testsuite/hints.rs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//! Tests for hints.
2+
3+
use crate::prelude::*;
4+
use cargo_test_support::{project, str};
5+
6+
#[cargo_test]
7+
fn empty_hints_warn() {
8+
let p = project()
9+
.file(
10+
"Cargo.toml",
11+
r#"
12+
[package]
13+
name = "foo"
14+
version = "0.0.1"
15+
edition = "2015"
16+
17+
[hints]
18+
"#,
19+
)
20+
.file("src/main.rs", "fn main() {}")
21+
.build();
22+
p.cargo("check -v")
23+
.with_stderr_data(str![[r#"
24+
[WARNING] unused manifest key: hints
25+
[CHECKING] foo v0.0.1 ([ROOT]/foo)
26+
[RUNNING] `rustc --crate-name foo [..]`
27+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
28+
29+
"#]])
30+
.run();
31+
}
32+
33+
#[cargo_test]
34+
fn unknown_hints_warn() {
35+
let p = project()
36+
.file(
37+
"Cargo.toml",
38+
r#"
39+
[package]
40+
name = "foo"
41+
version = "0.0.1"
42+
edition = "2015"
43+
44+
[hints]
45+
this-is-an-unknown-hint = true
46+
"#,
47+
)
48+
.file("src/main.rs", "fn main() {}")
49+
.build();
50+
p.cargo("check -v")
51+
.with_stderr_data(str![[r#"
52+
[WARNING] unused manifest key: hints
53+
[CHECKING] foo v0.0.1 ([ROOT]/foo)
54+
[RUNNING] `rustc --crate-name foo [..]`
55+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
56+
57+
"#]])
58+
.run();
59+
}

tests/testsuite/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ mod git_shallow;
106106
mod glob_targets;
107107
mod global_cache_tracker;
108108
mod help;
109+
mod hints;
109110
mod https;
110111
mod inheritable_workspace_fields;
111112
mod install;

0 commit comments

Comments
 (0)