3 use base_db::{fixture::WithFixture, SourceDatabase};
4 use expect_test::Expect;
6 use crate::ModuleDefId;
10 fn lower(ra_fixture: &str) -> Arc<Body> {
11 let db = crate::test_db::TestDB::with_files(ra_fixture);
13 let krate = db.crate_graph().iter().next().unwrap();
14 let def_map = db.crate_def_map(krate);
15 let mut fn_def = None;
16 'outer: for (_, module) in def_map.modules() {
17 for decl in module.scope.declarations() {
18 if let ModuleDefId::FunctionId(it) = decl {
25 db.body(fn_def.unwrap().into())
28 fn block_def_map_at(ra_fixture: &str) -> String {
29 let (db, position) = crate::test_db::TestDB::with_position(ra_fixture);
31 let module = db.module_at_position(position);
32 module.def_map(&db).dump(&db)
35 fn check_block_scopes_at(ra_fixture: &str, expect: Expect) {
36 let (db, position) = crate::test_db::TestDB::with_position(ra_fixture);
38 let module = db.module_at_position(position);
39 let actual = module.def_map(&db).dump_block_scopes(&db);
40 expect.assert_eq(&actual);
43 fn check_at(ra_fixture: &str, expect: Expect) {
44 let actual = block_def_map_at(ra_fixture);
45 expect.assert_eq(&actual);
49 fn your_stack_belongs_to_me() {
50 cov_mark::check!(your_stack_belongs_to_me);
53 macro_rules! n_nuple {
56 (n_nuple!($($rest)*)None,)
59 fn main() { n_nuple!(1,2,3); }
66 // Regression test for a path resolution bug introduced with inner item handling.
71 ($elem:expr; $n:expr) => { () };
72 ($($x:expr),+ $(,)?) => { () };
76 let _ = vec![FileSet::default(); self.len()];