From 20d55ce44d4260b6dce220ba64ce81f55299d2ce Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sat, 3 Apr 2021 12:50:55 +0800 Subject: Allow include! an empty content file --- crates/hir_def/src/nameres/tests/diagnostics.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'crates/hir_def/src/nameres/tests/diagnostics.rs') diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs index a89061c2e..fefdadb22 100644 --- a/crates/hir_def/src/nameres/tests/diagnostics.rs +++ b/crates/hir_def/src/nameres/tests/diagnostics.rs @@ -7,6 +7,11 @@ fn check_diagnostics(ra_fixture: &str) { db.check_diagnostics(); } +fn check_no_diagnostics(ra_fixture: &str) { + let db: TestDB = TestDB::with_files(ra_fixture); + db.check_no_diagnostics(); +} + #[test] fn unresolved_import() { check_diagnostics( @@ -201,6 +206,21 @@ fn builtin_macro_fails_expansion() { ); } +#[test] +fn include_macro_should_allow_empty_content() { + check_no_diagnostics( + r#" + //- /lib.rs + #[rustc_builtin_macro] + macro_rules! include { () => {} } + + include!("bar.rs"); + //- /bar.rs + // empty + "#, + ); +} + #[test] fn good_out_dir_diagnostic() { check_diagnostics( -- cgit v1.2.3