Skip to content

Commit 423a473

Browse files
authored
Update compile test to use ui_test 0.23 (#13245)
# Objective Closes #13241 ## Solution Update test utils to use `ui_test` 0.23.0. ## Testing - Run compile tests for bevy_ecs. cc @BD103
1 parent a22eced commit 423a473

File tree

6 files changed

+23
-10
lines changed

6 files changed

+23
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ exclude = [
1818
"crates/bevy_derive/compile_fail",
1919
"crates/bevy_ecs/compile_fail",
2020
"crates/bevy_reflect/compile_fail",
21+
"tools/compile_fail_utils",
2122
]
2223
members = [
2324
"crates/*",

crates/bevy_derive/compile_fail/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ license = "MIT OR Apache-2.0"
88
publish = false
99

1010
[dependencies]
11-
# ui_test dies if we don't specify the version. See oli-obk/ui_test#211
12-
bevy_derive = { path = "../", version = "0.14.0-dev" }
11+
bevy_derive = { path = "../" }
1312

1413
[dev-dependencies]
1514
compile_fail_utils = { path = "../../../tools/compile_fail_utils" }

crates/bevy_ecs/compile_fail/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ license = "MIT OR Apache-2.0"
88
publish = false
99

1010
[dependencies]
11-
# ui_test dies if we don't specify the version. See oli-obk/ui_test#211
12-
bevy_ecs = { path = "../", version = "0.14.0-dev" }
11+
bevy_ecs = { path = "../" }
1312

1413
[dev-dependencies]
1514
compile_fail_utils = { path = "../../../tools/compile_fail_utils" }

crates/bevy_reflect/compile_fail/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ license = "MIT OR Apache-2.0"
88
publish = false
99

1010
[dependencies]
11-
# ui_test dies if we don't specify the version. See oli-obk/ui_test#211
12-
bevy_reflect = { path = "../", version = "0.14.0-dev" }
11+
bevy_reflect = { path = "../" }
1312

1413
[dev-dependencies]
1514
compile_fail_utils = { path = "../../../tools/compile_fail_utils" }

tools/compile_fail_utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
publish = false
99

1010
[dependencies]
11-
ui_test = "0.22.3"
11+
ui_test = "0.23.0"
1212

1313
[[test]]
1414
name = "example"

tools/compile_fail_utils/src/lib.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,25 @@ use std::{
77
pub use ui_test;
88

99
use ui_test::{
10-
default_file_filter, default_per_file_config, run_tests_generic,
10+
default_file_filter, default_per_file_config,
11+
dependencies::DependencyBuilder,
12+
run_tests_generic,
13+
spanned::Spanned,
1114
status_emitter::{Gha, StatusEmitter, Text},
1215
Args, Config, OutputConflictHandling,
1316
};
1417

1518
/// Use this instead of hand rolling configs.
1619
///
1720
/// `root_dir` is the directory your tests are contained in. Needs to be a path from crate root.
21+
/// This config will build dependencies and will assume that the cargo manifest is placed at the
22+
/// current working directory.
1823
fn basic_config(root_dir: impl Into<PathBuf>, args: &Args) -> Config {
1924
let mut config = Config {
20-
dependencies_crate_manifest_path: Some("Cargo.toml".into()),
21-
bless_command: Some("`cargo test` with the BLESS environment variable set to any non empty value".to_string()),
25+
bless_command: Some(
26+
"`cargo test` with the BLESS environment variable set to any non empty value"
27+
.to_string(),
28+
),
2229
output_conflict_handling: if env::var_os("BLESS").is_some() {
2330
OutputConflictHandling::Bless
2431
} else {
@@ -45,6 +52,14 @@ fn basic_config(root_dir: impl Into<PathBuf>, args: &Args) -> Config {
4552
"$HOME",
4653
);
4754

55+
// Manually insert @aux-build:<dep> comments into test files. This needs to
56+
// be done to build and link dependencies. Dependencies will be pulled from a
57+
// Cargo.toml file.
58+
config.comment_defaults.base().custom.insert(
59+
"dependencies",
60+
Spanned::dummy(vec![Box::new(DependencyBuilder::default())]),
61+
);
62+
4863
config
4964
}
5065

0 commit comments

Comments
 (0)