diff --git a/Cargo.toml b/Cargo.toml index 321424880d1e..2603d7ab03e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ color-print = "0.3.4" anstream = "0.5.0" [dev-dependencies] -ui_test = "0.21.2" +ui_test = "0.22.0" tester = "0.9" regex = "1.5" toml = "0.7.3" diff --git a/tests/compile-test.rs b/tests/compile-test.rs index 3b7c974b65be..8374ffb3efdc 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -4,6 +4,7 @@ #![warn(rust_2018_idioms, unused_lifetimes)] #![allow(unused_extern_crates)] +use ui_test::spanned::Spanned; use ui_test::{status_emitter, Args, CommandBuilder, Config, Match, Mode, OutputConflictHandling}; use std::collections::BTreeMap; @@ -112,20 +113,22 @@ fn base_config(test_dir: &str) -> (Config, Args) { let target_dir = PathBuf::from(var_os("CARGO_TARGET_DIR").unwrap_or_else(|| "target".into())); let mut config = Config { - mode: Mode::Yolo { - rustfix: ui_test::RustfixMode::Everything, - }, filter_files: env::var("TESTNAME") .map(|filters| filters.split(',').map(str::to_string).collect()) .unwrap_or_default(), target: None, out_dir: target_dir.join("ui_test"), + output_conflict_handling: OutputConflictHandling::Error, + bless_command: Some("cargo uibless".into()), ..Config::rustc(Path::new("tests").join(test_dir)) }; - config.with_args(&args, /* bless by default */ false); - if let OutputConflictHandling::Error(err) = &mut config.output_conflict_handling { - *err = "cargo uibless".into(); - } + let comment_base = config.comment_defaults.base(); + comment_base.mode = Spanned::dummy(Mode::Yolo { + rustfix: ui_test::RustfixMode::Everything, + }) + .into(); + comment_base.diagnostic_code_prefix = Spanned::dummy(String::from("clippy::")).into(); + config.with_args(&args); let current_exe_path = env::current_exe().unwrap(); let deps_path = current_exe_path.parent().unwrap(); let profile_path = deps_path.parent().unwrap(); @@ -179,9 +182,7 @@ fn run_internal_tests() { return; } let (mut config, args) = base_config("ui-internal"); - if let OutputConflictHandling::Error(err) = &mut config.output_conflict_handling { - *err = "cargo uitest --features internal -- -- --bless".into(); - } + config.bless_command = Some("cargo uitest --features internal -- -- --bless".into()); ui_test::run_tests_generic( vec![config], @@ -196,8 +197,10 @@ fn run_ui_toml() { let (mut config, args) = base_config("ui-toml"); config - .stderr_filters - .push((Match::from(env::current_dir().unwrap().as_path()), b"$DIR")); + .comment_defaults + .base() + .normalize_stderr + .push((Match::from(env::current_dir().unwrap().as_path()), Vec::from(b"$DIR"))); ui_test::run_tests_generic( vec![config], @@ -234,11 +237,13 @@ fn run_ui_cargo() { } else { "cargo-clippy" }); - config.edition = None; + config.comment_defaults.base().edition = None.into(); config - .stderr_filters - .push((Match::from(env::current_dir().unwrap().as_path()), b"$DIR")); + .comment_defaults + .base() + .normalize_stderr + .push((Match::from(env::current_dir().unwrap().as_path()), Vec::from(b"$DIR"))); let ignored_32bit = |path: &Path| { // FIXME: for some reason the modules are linted in a different order for this test @@ -248,7 +253,11 @@ fn run_ui_cargo() { ui_test::run_tests_generic( vec![config], |path, config| { - path.ends_with("Cargo.toml") && ui_test::default_any_file_filter(path, config) && !ignored_32bit(path) + if path.ends_with("Cargo.toml") { + Some(ui_test::default_any_file_filter(path, config) && !ignored_32bit(path)) + } else { + None + } }, |_config, _path, _file_contents| {}, status_emitter::Text::from(args.format),