aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-05-24 14:47:05 +0100
committerAleksey Kladov <[email protected]>2020-05-24 14:47:05 +0100
commitd1ff0145a9fe84f86192b2d88d5f0bd96a95a98f (patch)
tree71e6c24fd83848afeef9e5c9ee3de164da26452d
parent733956617e53027fa27968f165a90422d49673b0 (diff)
Fix tests
-rw-r--r--crates/ra_ide/src/runnables.rs50
1 files changed, 25 insertions, 25 deletions
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs
index ed98e58e0..6e7e47199 100644
--- a/crates/ra_ide/src/runnables.rs
+++ b/crates/ra_ide/src/runnables.rs
@@ -70,10 +70,10 @@ fn runnable_fn(
70 let kind = if name_string == "main" { 70 let kind = if name_string == "main" {
71 RunnableKind::Bin 71 RunnableKind::Bin
72 } else { 72 } else {
73 let test_id = if let Some(module) = sema.to_def(&fn_def).map(|def| def.module(sema.db)) { 73 let test_id = match sema.to_def(&fn_def).map(|def| def.module(sema.db)) {
74 let def = sema.to_def(&fn_def)?; 74 Some(module) => {
75 let impl_trait_name = 75 let def = sema.to_def(&fn_def)?;
76 def.as_assoc_item(sema.db).and_then(|assoc_item| { 76 let impl_trait_name = def.as_assoc_item(sema.db).and_then(|assoc_item| {
77 match assoc_item.container(sema.db) { 77 match assoc_item.container(sema.db) {
78 hir::AssocItemContainer::Trait(trait_item) => { 78 hir::AssocItemContainer::Trait(trait_item) => {
79 Some(trait_item.name(sema.db).to_string()) 79 Some(trait_item.name(sema.db).to_string())
@@ -85,25 +85,25 @@ fn runnable_fn(
85 } 85 }
86 }); 86 });
87 87
88 let path_iter = module 88 let path_iter = module
89 .path_to_root(sema.db) 89 .path_to_root(sema.db)
90 .into_iter() 90 .into_iter()
91 .rev() 91 .rev()
92 .filter_map(|it| it.name(sema.db)) 92 .filter_map(|it| it.name(sema.db))
93 .map(|name| name.to_string()); 93 .map(|name| name.to_string());
94 94
95 let path = if let Some(impl_trait_name) = impl_trait_name { 95 let path = if let Some(impl_trait_name) = impl_trait_name {
96 path_iter 96 path_iter
97 .chain(std::iter::once(impl_trait_name)) 97 .chain(std::iter::once(impl_trait_name))
98 .chain(std::iter::once(name_string)) 98 .chain(std::iter::once(name_string))
99 .join("::") 99 .join("::")
100 } else { 100 } else {
101 path_iter.chain(std::iter::once(name_string)).join("::") 101 path_iter.chain(std::iter::once(name_string)).join("::")
102 }; 102 };
103 103
104 TestId::Path(path) 104 TestId::Path(path)
105 } else { 105 }
106 TestId::Name(name_string) 106 None => TestId::Name(name_string),
107 }; 107 };
108 108
109 if has_test_related_attribute(&fn_def) { 109 if has_test_related_attribute(&fn_def) {
@@ -472,7 +472,7 @@ mod tests {
472 Runnable { 472 Runnable {
473 range: 1..58, 473 range: 1..58,
474 kind: Test { 474 kind: Test {
475 test_id: Name( 475 test_id: Path(
476 "test_foo1", 476 "test_foo1",
477 ), 477 ),
478 attr: TestAttr { 478 attr: TestAttr {
@@ -509,7 +509,7 @@ mod tests {
509 Runnable { 509 Runnable {
510 range: 1..80, 510 range: 1..80,
511 kind: Test { 511 kind: Test {
512 test_id: Name( 512 test_id: Path(
513 "test_foo1", 513 "test_foo1",
514 ), 514 ),
515 attr: TestAttr { 515 attr: TestAttr {