Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavier Denis authored and Xavier Denis committed May 28, 2024
1 parent a837b45 commit f04e095
Show file tree
Hide file tree
Showing 4 changed files with 384 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/integrations/basic-fail/Cargo.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ Location:
$DIR/src/lib.rs:LL:CC)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: test failed, to rerun pass `--test ui_tests_bless`
Error: tests failed

Location:
$DIR/src/lib.rs:LL:CC
error: test failed, to rerun pass `--test ui_tests_diff_only`

Caused by:
process didn't exit successfully: `$DIR/target/ui/tests/integrations/basic-fail/debug/deps/ui_tests_diff_only-HASH` (exit status: 1)
Error: failed to parse rustc version info: invalid_foobarlaksdfalsdfj

Caused by:
Expand All @@ -31,8 +39,9 @@ error: test failed, to rerun pass `--test ui_tests_invalid_program2`

Caused by:
process didn't exit successfully: `$DIR/target/ui/tests/integrations/basic-fail/debug/deps/ui_tests_invalid_program2-HASH` (exit status: 1)
error: 4 targets failed:
error: 5 targets failed:
`--test ui_tests`
`--test ui_tests_bless`
`--test ui_tests_diff_only`
`--test ui_tests_invalid_program`
`--test ui_tests_invalid_program2`
352 changes: 352 additions & 0 deletions tests/integrations/basic-fail/Cargo.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,358 @@ tests/actual_tests/rustc_ice.rs ... FAILED
tests/actual_tests/touching_above_below.rs ... FAILED
tests/actual_tests/touching_above_below_chain.rs ... FAILED

FAILED TEST: tests/actual_tests/bad_pattern.rs
command: "rustc" "--error-format=json" "--out-dir" "$TMP "tests/actual_tests/bad_pattern.rs" "--edition" "2021"

error: actual output differed from expected
Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/bad_pattern.stderr` to the actual output
--- tests/actual_tests/bad_pattern.stderr
+++ <stderr output>
-error[E0308]: mismatched types
+error[E0432]: unresolved import `basic_fail`
- --> tests/actual_tests/bad_pattern.rs:4:9
+ --> tests/actual_tests/bad_pattern.rs:1:5
|
-4 | add("42", 3);
+1 | use basic_fail::add;
- | --- ^^^^ expected `usize`, found `&str`
+ | ^^^^^^^^^^ use of undeclared crate or module `basic_fail`

-error: aborting due to previous error
+error: aborting due to 1 previous error

-For more information about this error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0432`.


error: `miesmätsched types` not found in diagnostics on line 4
--> tests/actual_tests/bad_pattern.rs:5:17
|
5 | //~^ ERROR: miesmätsched types
| ^^^^^^^^^^^^^^^^^^ expected because of this pattern
|

error: there were 1 unmatched diagnostics
--> tests/actual_tests/bad_pattern.rs:1:5
|
1 | use basic_fail::add;
| ^^^^^^^^^^ Error[E0432]: unresolved import `basic_fail`
|


FAILED TEST: tests/actual_tests/executable.rs
command: "rustc" "--error-format=json" "--out-dir" "$TMP "tests/actual_tests/executable.rs" "--edition" "2021"

error: pass test got exit status: 1, but expected 0
= note: compilation failed, but was expected to succeed

error: actual output differed from expected
Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/executable.stderr` to the actual output
--- tests/actual_tests/executable.stderr
+++ <stderr output>
+error[E0432]: unresolved import `basic_fail`
+ --> tests/actual_tests/executable.rs:1:5
+ |
+1 | use basic_fail::add;
+ | ^^^^^^^^^^ use of undeclared crate or module `basic_fail`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0432`.


error: there were 1 unmatched diagnostics
--> tests/actual_tests/executable.rs:1:5
|
1 | use basic_fail::add;
| ^^^^^^^^^^ Error[E0432]: unresolved import `basic_fail`
|


FAILED TEST: tests/actual_tests/executable_compile_err.rs
command: "rustc" "--error-format=json" "--out-dir" "$TMP "tests/actual_tests/executable_compile_err.rs" "--edition" "2021"

error: pass test got exit status: 1, but expected 0
= note: compilation failed, but was expected to succeed

error: actual output differed from expected
Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/executable_compile_err.stderr` to the actual output
--- tests/actual_tests/executable_compile_err.stderr
+++ <stderr output>
+error: this file contains an unclosed delimiter
+ --> tests/actual_tests/executable_compile_err.rs:4:2
+ |
+3 | fn main() {
+ | - unclosed delimiter
+4 |
+ | ^
+
+error: aborting due to 1 previous error
+


error: there were 1 unmatched diagnostics
--> tests/actual_tests/executable_compile_err.rs:4:1
|
4 | ...
| ^ Error: this file contains an unclosed delimiter
|


FAILED TEST: tests/actual_tests/exit_code_fail.rs
command: "rustc" "--error-format=json" "--out-dir" "$TMP "tests/actual_tests/exit_code_fail.rs" "--edition" "2021"

error: fail test got exit status: 0, but expected 1
= note: compilation succeeded, but was expected to fail

error: no error patterns found in fail test


FAILED TEST: tests/actual_tests/filters.rs
command: "parse comments"

error: `x86_64` is not a valid condition, expected `on-host`, /[0-9]+bit/, /host-.*/, or /target-.*/
--> tests/actual_tests/filters.rs:1:9
|
1 | //@only-x86_64
| ^^^^^^
|


FAILED TEST: tests/actual_tests/foomp.rs
command: "rustc" "--error-format=json" "--out-dir" "$TMP "tests/actual_tests/foomp.rs" "--edition" "2021"

error: actual output differed from expected
Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/foomp.stderr` to the actual output
--- tests/actual_tests/foomp.stderr
+++ <stderr output>
-error[E0308]: mismatched types
+error[E0432]: unresolved import `basic_fail`
- --> tests/actual_tests/foomp.rs:4:9
+ --> tests/actual_tests/foomp.rs:1:5
|
-4 | add("42", 3);
+1 | use basic_fail::add;
- | --- ^^^^ expected `usize`, found `&str`
+ | ^^^^^^^^^^ use of undeclared crate or module `basic_fail`

-error: aborting doo to previous error
+error: aborting due to 1 previous error

-For more information about this error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0432`.


error: `mismatched types` not found in diagnostics on line 4
--> tests/actual_tests/foomp.rs:5:17
|
5 | //~^ ERROR: mismatched types
| ^^^^^^^^^^^^^^^^ expected because of this pattern
|

error: there were 1 unmatched diagnostics
--> tests/actual_tests/foomp.rs:1:5
|
1 | use basic_fail::add;
| ^^^^^^^^^^ Error[E0432]: unresolved import `basic_fail`
|


FAILED TEST: tests/actual_tests/foomp2.rs
command: "rustc" "--error-format=json" "--out-dir" "$TMP "tests/actual_tests/foomp2.rs" "--edition" "2021"

error: actual output differed from expected
Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/foomp2.stderr` to the actual output
--- tests/actual_tests/foomp2.stderr
+++ <stderr output>
-error[E0308]: mismatched types
+error[E0432]: unresolved import `basic_fail`
- --> tests/actual_tests/foomp2.rs:4:9
+ --> tests/actual_tests/foomp2.rs:1:5
|
-4 | add("42", 3);
+1 | use basic_fail::add;
- | --- ^^^^ expected `usize`, found `&str`
+ | ^^^^^^^^^^ use of undeclared crate or module `basic_fail`

-error: aborting due to previous error
+error: aborting due to 1 previous error

-For more information about this error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0432`.


error: `mismatched types` not found in diagnostics on line 4
--> tests/actual_tests/foomp2.rs:5:17
|
5 | //~^ ERROR: mismatched types
| ^^^^^^^^^^^^^^^^ expected because of this pattern
|

error: there were 1 unmatched diagnostics
--> tests/actual_tests/foomp2.rs:1:5
|
1 | use basic_fail::add;
| ^^^^^^^^^^ Error[E0432]: unresolved import `basic_fail`
|


FAILED TEST: tests/actual_tests/inline_chain.rs
command: "parse comments"

error: `//~|` comment not attached to anchoring matcher
--> tests/actual_tests/inline_chain.rs:5:26
|
5 | //~| unused_variables
| ^
|


FAILED TEST: tests/actual_tests/joined_wrong_order.rs
command: "parse comments"

error: `//~|` comment not attached to anchoring matcher
--> tests/actual_tests/joined_wrong_order.rs:5:8
|
5 | //~| unused_mut
| ^
|


FAILED TEST: tests/actual_tests/lone_joined_pattern.rs
command: "parse comments"

error: `//~|` comment not attached to anchoring matcher
--> tests/actual_tests/lone_joined_pattern.rs:2:8
|
2 | //~| ERROR: mismatched types
| ^
|

error: `//~|` comment not attached to anchoring matcher
--> tests/actual_tests/lone_joined_pattern.rs:4:8
|
4 | //~| ERROR: mismatched types
| ^
|


FAILED TEST: tests/actual_tests/pattern_too_many_arrow.rs
command: "parse comments"

error: //~^ pattern is trying to refer to 7 lines above, but there are only 2 lines above
--> tests/actual_tests/pattern_too_many_arrow.rs:3:8
|
3 | //~^^^^^^^ ERROR: mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|


FAILED TEST: tests/actual_tests/pattern_too_many_arrow_above.rs
command: "parse comments"

error: //~v pattern is trying to refer to line 8, but the file only has 6 lines
--> tests/actual_tests/pattern_too_many_arrow_above.rs:2:22
|
2 | //~vvvvvv ERROR: mismatched types
| ^^^^^^^^^^^^^^^^
|


FAILED TEST: tests/actual_tests/rustc_ice.rs
command: "rustc" "--error-format=json" "--out-dir" "$TMP "tests/actual_tests/rustc_ice.rs" "-Ztreat-err-as-bug" "--edition" "2021"

error: fail test got exit status: 101, but expected 1
= note: the compiler panicked

error: actual output differed from expected
Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/rustc_ice.stderr` to the actual output
--- tests/actual_tests/rustc_ice.stderr
+++ <stderr output>
-error: internal compiler error[E0308]: mismatched types
+error: internal compiler error[E0432]: unresolved import `basic_fail`
- --> tests/actual_tests/rustc_ice.rs:8:9
+ --> tests/actual_tests/rustc_ice.rs:5:5
|
-8 | add("42", 3);
+5 | use basic_fail::add;
- | --- ^^^^ expected `usize`, found `&str`
+ | ^^^^^^^^^^ use of undeclared crate or module `basic_fail`

thread 'rustc' panicked


error: `mismatched types` not found in diagnostics on line 8
--> tests/actual_tests/rustc_ice.rs:9:17
|
9 | //~^ ERROR: mismatched types
| ^^^^^^^^^^^^^^^^ expected because of this pattern
|

error: there were 1 unmatched diagnostics
--> tests/actual_tests/rustc_ice.rs:5:5
|
5 | use basic_fail::add;
| ^^^^^^^^^^ Ice: unresolved import `basic_fail`
|


FAILED TEST: tests/actual_tests/touching_above_below.rs
command: "parse comments"

error: `//~v` comment immediately following a `//~^` comment chain
--> tests/actual_tests/touching_above_below.rs:4:8
|
4 | //~v ERROR: mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|


FAILED TEST: tests/actual_tests/touching_above_below_chain.rs
command: "parse comments"

error: `//~v` comment immediately following a `//~^` comment chain
--> tests/actual_tests/touching_above_below_chain.rs:5:8
|
5 | //~v ERROR: unused variable
| ^^^^^^^^^^^^^^^^^^^^^^^^
|

FAILURES:
tests/actual_tests/bad_pattern.rs
tests/actual_tests/executable.rs
tests/actual_tests/executable_compile_err.rs
tests/actual_tests/exit_code_fail.rs
tests/actual_tests/filters.rs
tests/actual_tests/foomp.rs
tests/actual_tests/foomp2.rs
tests/actual_tests/inline_chain.rs
tests/actual_tests/joined_wrong_order.rs
tests/actual_tests/lone_joined_pattern.rs
tests/actual_tests/pattern_too_many_arrow.rs
tests/actual_tests/pattern_too_many_arrow_above.rs
tests/actual_tests/rustc_ice.rs
tests/actual_tests/touching_above_below.rs
tests/actual_tests/touching_above_below_chain.rs

test result: FAIL. 15 failed;

tests/actual_tests/bad_pattern.rs ... FAILED
tests/actual_tests/executable.rs ... FAILED
tests/actual_tests/executable_compile_err.rs ... FAILED
tests/actual_tests/exit_code_fail.rs ... FAILED
tests/actual_tests/filters.rs ... FAILED
tests/actual_tests/foomp.rs ... FAILED
tests/actual_tests/foomp2.rs ... FAILED
tests/actual_tests/inline_chain.rs ... FAILED
tests/actual_tests/joined_wrong_order.rs ... FAILED
tests/actual_tests/lone_joined_pattern.rs ... FAILED
tests/actual_tests/pattern_too_many_arrow.rs ... FAILED
tests/actual_tests/pattern_too_many_arrow_above.rs ... FAILED
tests/actual_tests/rustc_ice.rs ... FAILED
tests/actual_tests/touching_above_below.rs ... FAILED
tests/actual_tests/touching_above_below_chain.rs ... FAILED

FAILED TEST: tests/actual_tests/bad_pattern.rs
command: "$CMD" "tests/actual_tests/bad_pattern.rs" "--edition" "2021"

Expand Down
4 changes: 4 additions & 0 deletions tests/integrations/basic-fail/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ harness = false
name = "ui_tests_invalid_program2"
harness = false

[[test]]
name = "ui_tests_diff_only"
harness = false

[[test]]
name = "ui_tests_bless"
harness = false
Loading

0 comments on commit f04e095

Please sign in to comment.