Add failing test

This commit is contained in:
Aleksey Kladov 2020-04-10 19:28:32 +02:00
parent c476742f47
commit 5e2f29af85

View File

@ -1,10 +1,13 @@
use std::fs;
use insta::assert_snapshot; use insta::assert_snapshot;
use ra_db::fixture::WithFixture; use ra_db::fixture::WithFixture;
use test_utils::project_dir;
use super::{infer, type_at, type_at_pos};
use crate::test_db::TestDB; use crate::test_db::TestDB;
use super::{infer, type_at, type_at_pos};
#[test] #[test]
fn cfg_impl_def() { fn cfg_impl_def() {
let (db, pos) = TestDB::with_position( let (db, pos) = TestDB::with_position(
@ -481,6 +484,30 @@ fn bar() -> u32 {0}
assert_eq!("u32", type_at_pos(&db, pos)); 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] #[test]
fn infer_builtin_macros_include_concat() { fn infer_builtin_macros_include_concat() {
let (db, pos) = TestDB::with_position( let (db, pos) = TestDB::with_position(