Fix tests

This commit is contained in:
Aleksey Kladov 2020-05-24 15:47:05 +02:00
parent 733956617e
commit d1ff0145a9

View file

@ -70,10 +70,10 @@ fn runnable_fn(
let kind = if name_string == "main" {
RunnableKind::Bin
} else {
let test_id = if let Some(module) = sema.to_def(&fn_def).map(|def| def.module(sema.db)) {
let test_id = match sema.to_def(&fn_def).map(|def| def.module(sema.db)) {
Some(module) => {
let def = sema.to_def(&fn_def)?;
let impl_trait_name =
def.as_assoc_item(sema.db).and_then(|assoc_item| {
let impl_trait_name = def.as_assoc_item(sema.db).and_then(|assoc_item| {
match assoc_item.container(sema.db) {
hir::AssocItemContainer::Trait(trait_item) => {
Some(trait_item.name(sema.db).to_string())
@ -102,8 +102,8 @@ fn runnable_fn(
};
TestId::Path(path)
} else {
TestId::Name(name_string)
}
None => TestId::Name(name_string),
};
if has_test_related_attribute(&fn_def) {
@ -472,7 +472,7 @@ mod tests {
Runnable {
range: 1..58,
kind: Test {
test_id: Name(
test_id: Path(
"test_foo1",
),
attr: TestAttr {
@ -509,7 +509,7 @@ mod tests {
Runnable {
range: 1..80,
kind: Test {
test_id: Name(
test_id: Path(
"test_foo1",
),
attr: TestAttr {