File tree Expand file tree Collapse file tree 3 files changed +29
-5
lines changed
tools/compile_fail_utils/tests Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change 1- fn main ( ) -> bevy_compile_test_utils :: ui_test:: Result < ( ) > {
1+ fn main ( ) -> compile_fail_utils :: ui_test:: Result < ( ) > {
22 // Run all tests in the tests/example_tests folder.
33 // If we had more tests we could either call this function
44 // on everysingle one or use test_multiple and past it an array
55 // of paths.
66 //
77 // Don't forget that when running tests the working directory
88 // is set to the crate root.
9- bevy_compile_test_utils :: test ( "tests/example_tests" )
9+ compile_fail_utils :: test ( "example_tests" , "tests/example_tests" )
1010}
Original file line number Diff line number Diff line change 1+ // Compiler warnings also need to be annotated. We don't
2+ // want to annotate all the unused variables so let's instruct
3+ // the compiler to ignore them.
4+ #![allow(unused_variables)]
5+
6+ fn bad_moves() {
7+ let x = String::new();
8+ // Help diagnostics need to be annotated
9+ let y = x.clone();
10+ //~^ HELP: consider cloning
11+
12+ // We expect a failure on this line
13+ println!("{x}"); //~ ERROR: borrow
14+
15+
16+ let x = String::new();
17+ // We expect the help message to mention cloning.
18+ //~v HELP: consider cloning
19+ let y = x.clone();
20+
21+ // Check error message using a regex
22+ println!("{x}");
23+ //~^ ERROR: /(move)|(borrow)/
24+ }
Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ error[E0599]: no function or associated item named `this_function_does_not_exist
77note: if you're trying to build a new `Config` consider using one of the following associated functions:
88 Config::rustc
99 Config::cargo
10- --> $RUSTUP_HOME/.cargo/git/checkouts/ ui_test-2b82183a391bb05c/680bb08/ src/config.rs:63 :5
10+ --> $RUSTUP_HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ ui_test-0.23.0/ src/config.rs:70 :5
1111 |
12- 63 | pub fn rustc(root_dir: impl Into<PathBuf>) -> Self {
12+ 70 | pub fn rustc(root_dir: impl Into<PathBuf>) -> Self {
1313 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414...
15- 108 | pub fn cargo(root_dir: impl Into<PathBuf>) -> Self {
15+ 221 | pub fn cargo(root_dir: impl Into<PathBuf>) -> Self {
1616 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1717
1818error: aborting due to 1 previous error
You can’t perform that action at this time.
0 commit comments