#[cfg(test)]
mod test_db;
+#[cfg(test)]
+mod marks;
// FIXME: this should be private
pub mod nameres;
--- /dev/null
+//! See test_utils/src/marks.rs
+
+test_utils::marks!(
+ bogus_paths
+ name_res_works_for_broken_modules
+ can_import_enum_variant
+ glob_enum
+ glob_across_crates
+ std_prelude
+ macro_rules_from_other_crates_are_visible_with_macro_use
+ prelude_is_macro_use
+ macro_dollar_crate_self
+ macro_dollar_crate_other
+);
use ra_prof::profile;
use ra_syntax::ast;
use rustc_hash::{FxHashMap, FxHashSet};
-// use test_utils::tested_by;
+use test_utils::tested_by;
use crate::{
builtin_type::BuiltinType,
let mut curr_per_ns: PerNs = match path.kind {
PathKind::DollarCrate(krate) => {
if krate == self.krate {
- // tested_by!(macro_dollar_crate_self);
+ tested_by!(macro_dollar_crate_self);
PerNs::types(ModuleId { krate: self.krate, module_id: self.root }.into())
} else {
let def_map = db.crate_def_map(krate);
let module = ModuleId { krate, module_id: def_map.root };
- // tested_by!(macro_dollar_crate_other);
+ tested_by!(macro_dollar_crate_other);
PerNs::types(module.into())
}
}
}
ModuleDefId::AdtId(AdtId::EnumId(e)) => {
// enum variant
- // tested_by!(can_import_enum_variant);
+ tested_by!(can_import_enum_variant);
let enum_data = db.enum_data(e);
match enum_data.variant(&segment.name) {
Some(local_id) => {
use ra_db::{CrateId, FileId};
use ra_syntax::{ast, SmolStr};
use rustc_hash::FxHashMap;
-// use test_utils::tested_by;
+use test_utils::tested_by;
use crate::{
attr::Attr,
);
if let Some(ModuleDefId::ModuleId(m)) = res.take_types() {
- // tested_by!(macro_rules_from_other_crates_are_visible_with_macro_use);
+ tested_by!(macro_rules_from_other_crates_are_visible_with_macro_use);
self.import_all_macros_exported(current_module_id, m.krate);
}
}
match def.take_types() {
Some(ModuleDefId::ModuleId(m)) => {
if import.is_prelude {
- // tested_by!(std_prelude);
+ tested_by!(std_prelude);
self.def_map.prelude = Some(m);
} else if m.krate != self.def_map.krate {
- // tested_by!(glob_across_crates);
+ tested_by!(glob_across_crates);
// glob import from other crate => we can just import everything once
let item_map = self.db.crate_def_map(m.krate);
let scope = &item_map[m.module_id].scope;
}
}
Some(ModuleDefId::AdtId(AdtId::EnumId(e))) => {
- // tested_by!(glob_enum);
+ tested_by!(glob_enum);
// glob import from enum => just import all the variants
let enum_data = self.db.enum_data(e);
let resolutions = enum_data
let resolution = Resolution { def, import: Some(import_id) };
self.update(module_id, Some(import_id), &[(name, resolution)]);
}
- // tested_by!(bogus_paths),
- None => (),
+ None => tested_by!(bogus_paths),
}
}
}
// Prelude module is always considered to be `#[macro_use]`.
if let Some(prelude_module) = self.def_collector.def_map.prelude {
if prelude_module.krate != self.def_collector.def_map.krate {
- // tested_by!(prelude_is_macro_use);
+ tested_by!(prelude_is_macro_use);
self.def_collector.import_all_macros_exported(self.module_id, prelude_module.krate);
}
}
ast::{self, AttrsOwner, NameOwner},
AstNode, AstPtr, SourceFile,
};
+use test_utils::tested_by;
use crate::{attr::Attr, db::DefDatabase2, path::Path, FileAstId, HirFileId, ModuleSource, Source};
self.push_item(current_module, attrs, RawItemKind::Module(item));
return;
}
- // FIXME: restore this mark once we complete hir splitting
- // tested_by!(name_res_works_for_broken_modules);
+ tested_by!(name_res_works_for_broken_modules);
}
fn add_use_item(&mut self, current_module: Option<Module>, use_item: ast::UseItem) {
use insta::assert_snapshot;
use ra_db::{fixture::WithFixture, SourceDatabase};
-// use test_utils::covers;
+use test_utils::covers;
use crate::{db::DefDatabase2, nameres::*, test_db::TestDB, CrateModuleId};
#[test]
fn bogus_paths() {
- // covers!(bogus_paths);
+ covers!(bogus_paths);
let map = def_map(
"
//- /lib.rs
#[test]
fn std_prelude() {
- // covers!(std_prelude);
+ covers!(std_prelude);
let map = def_map(
"
//- /main.rs crate:main deps:test_crate
#[test]
fn can_import_enum_variant() {
- // covers!(can_import_enum_variant);
+ covers!(can_import_enum_variant);
let map = def_map(
"
//- /lib.rs
#[test]
fn glob_across_crates() {
- // covers!(glob_across_crates);
+ covers!(glob_across_crates);
let map = def_map(
"
//- /main.rs crate:main deps:test_crate
#[test]
fn glob_enum() {
- // covers!(glob_enum);
+ covers!(glob_enum);
let map = def_map(
"
//- /lib.rs
#[test]
fn macro_rules_from_other_crates_are_visible_with_macro_use() {
- // covers!(macro_rules_from_other_crates_are_visible_with_macro_use);
+ covers!(macro_rules_from_other_crates_are_visible_with_macro_use);
let map = def_map(
"
//- /main.rs crate:main deps:foo
#[test]
fn prelude_is_macro_use() {
- // covers!(prelude_is_macro_use);
+ covers!(prelude_is_macro_use);
let map = def_map(
"
//- /main.rs crate:main deps:foo
#[test]
fn macro_dollar_crate_is_correct_in_item() {
- // covers!(macro_dollar_crate_self);
- // covers!(macro_dollar_crate_other);
+ covers!(macro_dollar_crate_self);
+ covers!(macro_dollar_crate_other);
let map = def_map(
"
//- /main.rs crate:main deps:foo
#[test]
fn macro_dollar_crate_is_correct_in_indirect_deps() {
- // covers!(macro_dollar_crate_other);
+ covers!(macro_dollar_crate_other);
// From std
let map = def_map(
r#"
#[test]
fn name_res_works_for_broken_modules() {
- // covers!(name_res_works_for_broken_modules);
+ covers!(name_res_works_for_broken_modules);
let map = def_map(
"
//- /lib.rs