Skip to content

Commit 00919a4

Browse files
committed
Update ui test crate to auto-detect aux build crate kind
1 parent 3d88fae commit 00919a4

File tree

144 files changed

+228
-327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+228
-327
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tempfile = { version = "3.2", optional = true }
2727
termize = "0.1"
2828

2929
[dev-dependencies]
30-
ui_test = "0.12"
30+
ui_test = "0.13"
3131
tester = "0.9"
3232
regex = "1.5"
3333
toml = "0.7.3"

tests/compile-test.rs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const RUN_INTERNAL_TESTS: bool = cfg!(feature = "internal");
113113
fn base_config(test_dir: &str) -> (compiletest::Config, Args) {
114114
let args = Args::test();
115115
let mut config = compiletest::Config {
116-
mode: TestMode::Yolo,
116+
mode: TestMode::Yolo { rustfix: true },
117117
stderr_filters: vec![],
118118
stdout_filters: vec![],
119119
output_conflict_handling: if var_os("GITHUB_ACTION").is_none()
@@ -124,7 +124,10 @@ fn base_config(test_dir: &str) -> (compiletest::Config, Args) {
124124
OutputConflictHandling::Error("cargo uibless".into())
125125
},
126126
target: None,
127-
out_dir: PathBuf::from(std::env::var_os("CARGO_TARGET_DIR").unwrap_or("target".into())).join("ui_test"),
127+
out_dir: PathBuf::from(std::env::var_os("CARGO_TARGET_DIR").unwrap_or("target".into()))
128+
.join("ui_test")
129+
.canonicalize()
130+
.unwrap(),
128131
..compiletest::Config::rustc(Path::new("tests").join(test_dir))
129132
};
130133
let current_exe_path = env::current_exe().unwrap();
@@ -188,12 +191,18 @@ fn run_ui() {
188191

189192
let test_filter = test_filter();
190193

194+
let quiet = args.quiet;
195+
191196
compiletest::run_tests_generic(
192197
config,
193198
args,
194199
move |path, args| compiletest::default_file_filter(path, args) && test_filter(path),
195200
compiletest::default_per_file_config,
196-
status_emitter::Text::verbose(),
201+
if quiet {
202+
status_emitter::Text::quiet()
203+
} else {
204+
status_emitter::Text::verbose()
205+
},
197206
)
198207
.unwrap();
199208
}
@@ -208,13 +217,18 @@ fn run_internal_tests() {
208217
*err = "cargo uitest --features internal".into();
209218
}
210219
let test_filter = test_filter();
220+
let quiet = args.quiet;
211221

212222
compiletest::run_tests_generic(
213223
config,
214224
args,
215225
move |path, args| compiletest::default_file_filter(path, args) && test_filter(path),
216226
compiletest::default_per_file_config,
217-
status_emitter::Text::verbose(),
227+
if quiet {
228+
status_emitter::Text::quiet()
229+
} else {
230+
status_emitter::Text::verbose()
231+
},
218232
)
219233
.unwrap();
220234
}
@@ -236,6 +250,7 @@ fn run_ui_toml() {
236250
);
237251

238252
let test_filter = test_filter();
253+
let quiet = args.quiet;
239254

240255
ui_test::run_tests_generic(
241256
config,
@@ -249,7 +264,11 @@ fn run_ui_toml() {
249264
.push(("CLIPPY_CONF_DIR".into(), Some(path.parent().unwrap().into())));
250265
Some(config)
251266
},
252-
status_emitter::Text::verbose(),
267+
if quiet {
268+
status_emitter::Text::quiet()
269+
} else {
270+
status_emitter::Text::verbose()
271+
},
253272
)
254273
.unwrap();
255274
}
@@ -291,6 +310,7 @@ fn run_ui_cargo() {
291310
);
292311

293312
let test_filter = test_filter();
313+
let quiet = args.quiet;
294314

295315
ui_test::run_tests_generic(
296316
config,
@@ -301,7 +321,11 @@ fn run_ui_cargo() {
301321
config.out_dir = PathBuf::from("target/ui_test_cargo/").join(path.parent().unwrap());
302322
Some(config)
303323
},
304-
status_emitter::Text::verbose(),
324+
if quiet {
325+
status_emitter::Text::quiet()
326+
} else {
327+
status_emitter::Text::verbose()
328+
},
305329
)
306330
.unwrap();
307331
}

tests/ui-internal/collapsible_span_lint_calls.fixed

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#![deny(clippy::internal)]
32
#![allow(clippy::missing_clippy_version_attribute)]
43
#![feature(rustc_private)]

tests/ui-internal/collapsible_span_lint_calls.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
error: this call is collapsible
2-
--> $DIR/collapsible_span_lint_calls.rs:36:9
2+
--> $DIR/collapsible_span_lint_calls.rs:35:9
33
|
44
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
55
LL | | db.span_suggestion(expr.span, help_msg, sugg.to_string(), Applicability::MachineApplicable);
66
LL | | });
77
| |__________^ help: collapse into: `span_lint_and_sugg(cx, TEST_LINT, expr.span, lint_msg, help_msg, sugg.to_string(), Applicability::MachineApplicable)`
88
|
99
note: the lint level is defined here
10-
--> $DIR/collapsible_span_lint_calls.rs:2:9
10+
--> $DIR/collapsible_span_lint_calls.rs:1:9
1111
|
1212
LL | #![deny(clippy::internal)]
1313
| ^^^^^^^^^^^^^^^^
1414
= note: `#[deny(clippy::collapsible_span_lint_calls)]` implied by `#[deny(clippy::internal)]`
1515

1616
error: this call is collapsible
17-
--> $DIR/collapsible_span_lint_calls.rs:39:9
17+
--> $DIR/collapsible_span_lint_calls.rs:38:9
1818
|
1919
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
2020
LL | | db.span_help(expr.span, help_msg);
2121
LL | | });
2222
| |__________^ help: collapse into: `span_lint_and_help(cx, TEST_LINT, expr.span, lint_msg, Some(expr.span), help_msg)`
2323

2424
error: this call is collapsible
25-
--> $DIR/collapsible_span_lint_calls.rs:42:9
25+
--> $DIR/collapsible_span_lint_calls.rs:41:9
2626
|
2727
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
2828
LL | | db.help(help_msg);
2929
LL | | });
3030
| |__________^ help: collapse into: `span_lint_and_help(cx, TEST_LINT, expr.span, lint_msg, None, help_msg)`
3131

3232
error: this call is collapsible
33-
--> $DIR/collapsible_span_lint_calls.rs:45:9
33+
--> $DIR/collapsible_span_lint_calls.rs:44:9
3434
|
3535
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
3636
LL | | db.span_note(expr.span, note_msg);
3737
LL | | });
3838
| |__________^ help: collapse into: `span_lint_and_note(cx, TEST_LINT, expr.span, lint_msg, Some(expr.span), note_msg)`
3939

4040
error: this call is collapsible
41-
--> $DIR/collapsible_span_lint_calls.rs:48:9
41+
--> $DIR/collapsible_span_lint_calls.rs:47:9
4242
|
4343
LL | / span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
4444
LL | | db.note(note_msg);

tests/ui-internal/interning_defined_symbol.fixed

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#![deny(clippy::internal)]
32
#![allow(clippy::missing_clippy_version_attribute, clippy::let_unit_value)]
43
#![feature(rustc_private)]

tests/ui-internal/interning_defined_symbol.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
error: interning a defined symbol
2-
--> $DIR/interning_defined_symbol.rs:18:13
2+
--> $DIR/interning_defined_symbol.rs:17:13
33
|
44
LL | let _ = Symbol::intern("f32");
55
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::sym::f32`
66
|
77
note: the lint level is defined here
8-
--> $DIR/interning_defined_symbol.rs:2:9
8+
--> $DIR/interning_defined_symbol.rs:1:9
99
|
1010
LL | #![deny(clippy::internal)]
1111
| ^^^^^^^^^^^^^^^^
1212
= note: `#[deny(clippy::interning_defined_symbol)]` implied by `#[deny(clippy::internal)]`
1313

1414
error: interning a defined symbol
15-
--> $DIR/interning_defined_symbol.rs:21:13
15+
--> $DIR/interning_defined_symbol.rs:20:13
1616
|
1717
LL | let _ = sym!(f32);
1818
| ^^^^^^^^^ help: try: `rustc_span::sym::f32`
1919

2020
error: interning a defined symbol
21-
--> $DIR/interning_defined_symbol.rs:24:13
21+
--> $DIR/interning_defined_symbol.rs:23:13
2222
|
2323
LL | let _ = Symbol::intern("proc-macro");
2424
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::sym::proc_dash_macro`
2525

2626
error: interning a defined symbol
27-
--> $DIR/interning_defined_symbol.rs:27:13
27+
--> $DIR/interning_defined_symbol.rs:26:13
2828
|
2929
LL | let _ = Symbol::intern("self");
3030
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::symbol::kw::SelfLower`

tests/ui-internal/invalid_msrv_attr_impl.fixed

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
#![deny(clippy::internal)]
42
#![allow(clippy::missing_clippy_version_attribute)]
53
#![feature(rustc_private)]

tests/ui-internal/invalid_msrv_attr_impl.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: `extract_msrv_attr!` macro missing from `LateLintPass` implementation
2-
--> $DIR/invalid_msrv_attr_impl.rs:30:1
2+
--> $DIR/invalid_msrv_attr_impl.rs:28:1
33
|
44
LL | impl LateLintPass<'_> for Pass {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
note: the lint level is defined here
8-
--> $DIR/invalid_msrv_attr_impl.rs:3:9
8+
--> $DIR/invalid_msrv_attr_impl.rs:1:9
99
|
1010
LL | #![deny(clippy::internal)]
1111
| ^^^^^^^^^^^^^^^^
@@ -17,7 +17,7 @@ LL + extract_msrv_attr!(LateContext);
1717
|
1818

1919
error: `extract_msrv_attr!` macro missing from `EarlyLintPass` implementation
20-
--> $DIR/invalid_msrv_attr_impl.rs:34:1
20+
--> $DIR/invalid_msrv_attr_impl.rs:32:1
2121
|
2222
LL | impl EarlyLintPass for Pass {
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui-internal/outer_expn_data.fixed

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
#![deny(clippy::internal)]
42
#![allow(clippy::missing_clippy_version_attribute)]
53
#![feature(rustc_private)]

tests/ui-internal/outer_expn_data.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: usage of `outer_expn().expn_data()`
2-
--> $DIR/outer_expn_data.rs:25:34
2+
--> $DIR/outer_expn_data.rs:23:34
33
|
44
LL | let _ = expr.span.ctxt().outer_expn().expn_data();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `outer_expn_data()`
66
|
77
note: the lint level is defined here
8-
--> $DIR/outer_expn_data.rs:3:9
8+
--> $DIR/outer_expn_data.rs:1:9
99
|
1010
LL | #![deny(clippy::internal)]
1111
| ^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)