mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-28 23:50:46 +00:00
Add ui test for include_file_outside_project
lint
This commit is contained in:
parent
a6ab226516
commit
d6dc48d888
2 changed files with 27 additions and 0 deletions
12
tests/ui/include_file_outside_project.rs
Normal file
12
tests/ui/include_file_outside_project.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
//@ normalize-stderr-test: "located at `.+/.crates.toml`" -> "located at `$$DIR/.crates.toml`"
|
||||
//@ normalize-stderr-test: "folder \(`.+`" -> "folder (`$$CLIPPY_DIR`"
|
||||
|
||||
#![deny(clippy::include_file_outside_project)]
|
||||
|
||||
// Should not lint.
|
||||
include!("./auxiliary/external_consts.rs");
|
||||
|
||||
fn main() {
|
||||
let x = include_str!(concat!(env!("CARGO_HOME"), "/.crates.toml"));
|
||||
//~^ include_file_outside_project
|
||||
}
|
15
tests/ui/include_file_outside_project.stderr
Normal file
15
tests/ui/include_file_outside_project.stderr
Normal file
|
@ -0,0 +1,15 @@
|
|||
error: attempted to include a file outside of the project
|
||||
--> tests/ui/include_file_outside_project.rs:10:13
|
||||
|
|
||||
LL | let x = include_str!(concat!(env!("CARGO_HOME"), "/.crates.toml"));
|
||||
| ^
|
||||
|
|
||||
= note: file is located at `$DIR/.crates.toml` which is outside of project folder (`$CLIPPY_DIR`)
|
||||
note: the lint level is defined here
|
||||
--> tests/ui/include_file_outside_project.rs:4:9
|
||||
|
|
||||
LL | #![deny(clippy::include_file_outside_project)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
Loading…
Reference in a new issue