aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/tests/test
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/tests/test')
-rw-r--r--crates/ra_ide_api/tests/test/main.rs56
1 files changed, 25 insertions, 31 deletions
diff --git a/crates/ra_ide_api/tests/test/main.rs b/crates/ra_ide_api/tests/test/main.rs
index 4126bd160..4cf842452 100644
--- a/crates/ra_ide_api/tests/test/main.rs
+++ b/crates/ra_ide_api/tests/test/main.rs
@@ -97,51 +97,45 @@ fn test_find_all_refs_for_fn_param() {
97 97
98#[test] 98#[test]
99fn test_world_symbols_with_no_container() { 99fn test_world_symbols_with_no_container() {
100 { 100 let code = r#"
101 let code = r#" 101 enum FooInner { }
102 enum FooInner { } 102 "#;
103 "#;
104 103
105 let mut symbols = get_symbols_matching(code, "FooInner"); 104 let mut symbols = get_symbols_matching(code, "FooInner");
106 105
107 let s = symbols.pop().unwrap(); 106 let s = symbols.pop().unwrap();
108 107
109 assert_eq!(s.name(), "FooInner"); 108 assert_eq!(s.name(), "FooInner");
110 assert!(s.container_name().is_none()); 109 assert!(s.container_name().is_none());
111 }
112} 110}
113 111
114#[test] 112#[test]
115fn test_world_symbols_include_container_name() { 113fn test_world_symbols_include_container_name() {
116 { 114 let code = r#"
117 let code = r#" 115fn foo() {
118 fn foo() { 116 enum FooInner { }
119 enum FooInner { } 117}
120 } 118 "#;
121 "#;
122 119
123 let mut symbols = get_symbols_matching(code, "FooInner"); 120 let mut symbols = get_symbols_matching(code, "FooInner");
124 121
125 let s = symbols.pop().unwrap(); 122 let s = symbols.pop().unwrap();
126 123
127 assert_eq!(s.name(), "FooInner"); 124 assert_eq!(s.name(), "FooInner");
128 assert_eq!(s.container_name(), Some(&SmolStr::new("foo"))); 125 assert_eq!(s.container_name(), Some(&SmolStr::new("foo")));
129 }
130 126
131 { 127 let code = r#"
132 let code = r#" 128mod foo {
133 mod foo { 129 struct FooInner;
134 struct FooInner; 130}
135 } 131 "#;
136 "#;
137 132
138 let mut symbols = get_symbols_matching(code, "FooInner"); 133 let mut symbols = get_symbols_matching(code, "FooInner");
139 134
140 let s = symbols.pop().unwrap(); 135 let s = symbols.pop().unwrap();
141 136
142 assert_eq!(s.name(), "FooInner"); 137 assert_eq!(s.name(), "FooInner");
143 assert_eq!(s.container_name(), Some(&SmolStr::new("foo"))); 138 assert_eq!(s.container_name(), Some(&SmolStr::new("foo")));
144 }
145} 139}
146 140
147#[test] 141#[test]