aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/tests/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/nameres/tests/diagnostics.rs')
-rw-r--r--crates/hir_def/src/nameres/tests/diagnostics.rs76
1 files changed, 0 insertions, 76 deletions
diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs
deleted file mode 100644
index f1ee03d4d..000000000
--- a/crates/hir_def/src/nameres/tests/diagnostics.rs
+++ /dev/null
@@ -1,76 +0,0 @@
1use base_db::fixture::WithFixture;
2
3use crate::test_db::TestDB;
4
5fn check_diagnostics(ra_fixture: &str) {
6 let db: TestDB = TestDB::with_files(ra_fixture);
7 db.check_diagnostics();
8}
9
10fn check_no_diagnostics(ra_fixture: &str) {
11 let db: TestDB = TestDB::with_files(ra_fixture);
12 db.check_no_diagnostics();
13}
14
15#[test]
16fn builtin_macro_fails_expansion() {
17 check_diagnostics(
18 r#"
19 //- /lib.rs
20 #[rustc_builtin_macro]
21 macro_rules! include { () => {} }
22
23 include!("doesntexist");
24 //^^^^^^^^^^^^^^^^^^^^^^^^ failed to load file `doesntexist`
25 "#,
26 );
27}
28
29#[test]
30fn include_macro_should_allow_empty_content() {
31 check_no_diagnostics(
32 r#"
33 //- /lib.rs
34 #[rustc_builtin_macro]
35 macro_rules! include { () => {} }
36
37 include!("bar.rs");
38 //- /bar.rs
39 // empty
40 "#,
41 );
42}
43
44#[test]
45fn good_out_dir_diagnostic() {
46 check_diagnostics(
47 r#"
48 #[rustc_builtin_macro]
49 macro_rules! include { () => {} }
50 #[rustc_builtin_macro]
51 macro_rules! env { () => {} }
52 #[rustc_builtin_macro]
53 macro_rules! concat { () => {} }
54
55 include!(concat!(env!("OUT_DIR"), "/out.rs"));
56 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `OUT_DIR` not set, enable "run build scripts" to fix
57 "#,
58 );
59}
60
61#[test]
62fn register_attr_and_tool() {
63 cov_mark::check!(register_attr);
64 cov_mark::check!(register_tool);
65 check_no_diagnostics(
66 r#"
67#![register_tool(tool)]
68#![register_attr(attr)]
69
70#[tool::path]
71#[attr]
72struct S;
73 "#,
74 );
75 // NB: we don't currently emit diagnostics here
76}