Skip to content

Commit 973f741

Browse files
committed
test(build-analysis): feature gate tests
1 parent 57fd101 commit 973f741

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

tests/testsuite/build_analysis.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//! Tests for `-Zbuild-analysis`.
2+
3+
use crate::prelude::*;
4+
5+
use cargo_test_support::basic_manifest;
6+
use cargo_test_support::project;
7+
use cargo_test_support::str;
8+
9+
#[cargo_test]
10+
fn gated() {
11+
let p = project()
12+
.file("Cargo.toml", &basic_manifest("foo", "0.0.0"))
13+
.file("src/lib.rs", "")
14+
.build();
15+
16+
p.cargo("check")
17+
.env("CARGO_BUILD_ANALYSIS_ENABLED", "true")
18+
.masquerade_as_nightly_cargo(&["build-analysis"])
19+
.with_stderr_data(str![[r#"
20+
[CHECKING] foo v0.0.0 ([ROOT]/foo)
21+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
22+
23+
"#]])
24+
.run();
25+
}
26+
27+
#[cargo_test]
28+
fn simple() {
29+
let p = project()
30+
.file("Cargo.toml", &basic_manifest("foo", "0.0.0"))
31+
.file("src/lib.rs", "")
32+
.build();
33+
34+
p.cargo("check -Zbuild-analysis")
35+
.env("CARGO_BUILD_ANALYSIS_ENABLED", "true")
36+
.masquerade_as_nightly_cargo(&["build-analysis"])
37+
.with_stderr_data(str![[r#"
38+
[CHECKING] foo v0.0.0 ([ROOT]/foo)
39+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
40+
41+
"#]])
42+
.run();
43+
}

tests/testsuite/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mod bad_manifest_path;
1111
mod bench;
1212
mod binary_name;
1313
mod build;
14+
mod build_analysis;
1415
mod build_dir;
1516
mod build_plan;
1617
mod build_script;

0 commit comments

Comments
 (0)