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
This commit is contained in:
Brezak 2024-05-06 00:17:56 +02:00 committed by GitHub
parent a22ecede49
commit 423a4732c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 23 additions and 10 deletions

View file

@ -18,6 +18,7 @@ exclude = [
"crates/bevy_derive/compile_fail", "crates/bevy_derive/compile_fail",
"crates/bevy_ecs/compile_fail", "crates/bevy_ecs/compile_fail",
"crates/bevy_reflect/compile_fail", "crates/bevy_reflect/compile_fail",
"tools/compile_fail_utils",
] ]
members = [ members = [
"crates/*", "crates/*",

View file

@ -8,8 +8,7 @@ license = "MIT OR Apache-2.0"
publish = false publish = false
[dependencies] [dependencies]
# ui_test dies if we don't specify the version. See oli-obk/ui_test#211 bevy_derive = { path = "../" }
bevy_derive = { path = "../", version = "0.14.0-dev" }
[dev-dependencies] [dev-dependencies]
compile_fail_utils = { path = "../../../tools/compile_fail_utils" } compile_fail_utils = { path = "../../../tools/compile_fail_utils" }

View file

@ -8,8 +8,7 @@ license = "MIT OR Apache-2.0"
publish = false publish = false
[dependencies] [dependencies]
# ui_test dies if we don't specify the version. See oli-obk/ui_test#211 bevy_ecs = { path = "../" }
bevy_ecs = { path = "../", version = "0.14.0-dev" }
[dev-dependencies] [dev-dependencies]
compile_fail_utils = { path = "../../../tools/compile_fail_utils" } compile_fail_utils = { path = "../../../tools/compile_fail_utils" }

View file

@ -8,8 +8,7 @@ license = "MIT OR Apache-2.0"
publish = false publish = false
[dependencies] [dependencies]
# ui_test dies if we don't specify the version. See oli-obk/ui_test#211 bevy_reflect = { path = "../" }
bevy_reflect = { path = "../", version = "0.14.0-dev" }
[dev-dependencies] [dev-dependencies]
compile_fail_utils = { path = "../../../tools/compile_fail_utils" } compile_fail_utils = { path = "../../../tools/compile_fail_utils" }

View file

@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
publish = false publish = false
[dependencies] [dependencies]
ui_test = "0.22.3" ui_test = "0.23.0"
[[test]] [[test]]
name = "example" name = "example"

View file

@ -7,7 +7,10 @@ use std::{
pub use ui_test; pub use ui_test;
use ui_test::{ use ui_test::{
default_file_filter, default_per_file_config, run_tests_generic, default_file_filter, default_per_file_config,
dependencies::DependencyBuilder,
run_tests_generic,
spanned::Spanned,
status_emitter::{Gha, StatusEmitter, Text}, status_emitter::{Gha, StatusEmitter, Text},
Args, Config, OutputConflictHandling, Args, Config, OutputConflictHandling,
}; };
@ -15,10 +18,14 @@ use ui_test::{
/// Use this instead of hand rolling configs. /// Use this instead of hand rolling configs.
/// ///
/// `root_dir` is the directory your tests are contained in. Needs to be a path from crate root. /// `root_dir` is the directory your tests are contained in. Needs to be a path from crate root.
/// This config will build dependencies and will assume that the cargo manifest is placed at the
/// current working directory.
fn basic_config(root_dir: impl Into<PathBuf>, args: &Args) -> Config { fn basic_config(root_dir: impl Into<PathBuf>, args: &Args) -> Config {
let mut config = Config { let mut config = Config {
dependencies_crate_manifest_path: Some("Cargo.toml".into()), bless_command: Some(
bless_command: Some("`cargo test` with the BLESS environment variable set to any non empty value".to_string()), "`cargo test` with the BLESS environment variable set to any non empty value"
.to_string(),
),
output_conflict_handling: if env::var_os("BLESS").is_some() { output_conflict_handling: if env::var_os("BLESS").is_some() {
OutputConflictHandling::Bless OutputConflictHandling::Bless
} else { } else {
@ -45,6 +52,14 @@ fn basic_config(root_dir: impl Into<PathBuf>, args: &Args) -> Config {
"$HOME", "$HOME",
); );
// Manually insert @aux-build:<dep> comments into test files. This needs to
// be done to build and link dependencies. Dependencies will be pulled from a
// Cargo.toml file.
config.comment_defaults.base().custom.insert(
"dependencies",
Spanned::dummy(vec![Box::new(DependencyBuilder::default())]),
);
config config
} }