From 5e2f29af851b7d89ed7f4be91bd1932d45b90eaa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 10 Apr 2020 19:28:32 +0200 Subject: Add failing test --- crates/ra_hir_ty/src/tests/macros.rs | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs index ff4599b71..f2a9b1c40 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/ra_hir_ty/src/tests/macros.rs @@ -1,10 +1,13 @@ +use std::fs; + use insta::assert_snapshot; use ra_db::fixture::WithFixture; - -use super::{infer, type_at, type_at_pos}; +use test_utils::project_dir; use crate::test_db::TestDB; +use super::{infer, type_at, type_at_pos}; + #[test] fn cfg_impl_def() { let (db, pos) = TestDB::with_position( @@ -481,6 +484,30 @@ fn bar() -> u32 {0} assert_eq!("u32", type_at_pos(&db, pos)); } +#[test] +#[ignore] +fn include_accidentally_quadratic() { + let file = project_dir().join("crates/ra_syntax/test_data/accidentally_quadratic"); + let big_file = fs::read_to_string(file).unwrap(); + let big_file = vec![big_file; 10].join("\n"); + + let fixture = r#" +//- /main.rs +#[rustc_builtin_macro] +macro_rules! include {() => {}} + +include!("foo.rs"); + +fn main() { + RegisterBlock { }<|>; +} + "#; + let fixture = format!("{}\n//- /foo.rs\n{}", fixture, big_file); + + let (db, pos) = TestDB::with_position(&fixture); + assert_eq!("RegisterBlock", type_at_pos(&db, pos)); +} + #[test] fn infer_builtin_macros_include_concat() { let (db, pos) = TestDB::with_position( -- cgit v1.2.3