aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/references
diff options
context:
space:
mode:
authorWilco Kusee <[email protected]>2019-11-29 15:03:39 +0000
committerWilco Kusee <[email protected]>2019-11-29 15:03:39 +0000
commit645df2b5f5664b7730293d8f7441364799aacbf9 (patch)
tree3ca7c4afb8d38730311a6f66fc76163c4edbffb1 /crates/ra_ide/src/references
parentbe9ba2b392aaada4b0ce72f61fd664fc3d4021b5 (diff)
Test rename for various identifiers
Diffstat (limited to 'crates/ra_ide/src/references')
-rw-r--r--crates/ra_ide/src/references/rename.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index ea6b354c2..c1771edf8 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -124,6 +124,49 @@ mod tests {
124 }; 124 };
125 125
126 #[test] 126 #[test]
127 fn test_rename_to_underscore() {
128 test_rename(
129 r#"
130 fn main() {
131 let i<|> = 1;
132 }"#,
133 "_",
134 r#"
135 fn main() {
136 let _ = 1;
137 }"#,
138 );
139 }
140
141 #[test]
142 fn test_rename_to_raw_identifier() {
143 test_rename(
144 r#"
145 fn main() {
146 let i<|> = 1;
147 }"#,
148 "r#fn",
149 r#"
150 fn main() {
151 let r#fn = 1;
152 }"#,
153 );
154 }
155
156 #[test]
157 fn test_rename_to_invalid_identifier() {
158 let (analysis, position) = single_file_with_position(
159 "
160 fn main() {
161 let i<|> = 1;
162 }",
163 );
164 let new_name = "invalid!";
165 let source_change = analysis.rename(position, new_name).unwrap();
166 assert!(source_change.is_none());
167 }
168
169 #[test]
127 fn test_rename_for_local() { 170 fn test_rename_for_local() {
128 test_rename( 171 test_rename(
129 r#" 172 r#"