diff options
Diffstat (limited to 'crates/ra_assists/src/ast_editor.rs')
-rw-r--r-- | crates/ra_assists/src/ast_editor.rs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs index 283b280b6..6854294ae 100644 --- a/crates/ra_assists/src/ast_editor.rs +++ b/crates/ra_assists/src/ast_editor.rs | |||
@@ -331,31 +331,3 @@ mod tokens { | |||
331 | } | 331 | } |
332 | 332 | ||
333 | } | 333 | } |
334 | |||
335 | #[cfg(test)] | ||
336 | mod tests { | ||
337 | use super::*; | ||
338 | |||
339 | use ra_syntax::SourceFile; | ||
340 | |||
341 | #[test] | ||
342 | fn structure_editing() { | ||
343 | let file = SourceFile::parse( | ||
344 | "\ | ||
345 | fn foo() { | ||
346 | let s = S { | ||
347 | original: 92, | ||
348 | } | ||
349 | } | ||
350 | ", | ||
351 | ); | ||
352 | let field_list = file.syntax().descendants().find_map(ast::NamedFieldList::cast).unwrap(); | ||
353 | let mut editor = AstEditor::new(field_list); | ||
354 | |||
355 | let field = AstBuilder::<ast::NamedField>::from_text("first_inserted: 1"); | ||
356 | editor.append_field(&field); | ||
357 | let field = AstBuilder::<ast::NamedField>::from_text("second_inserted: 2"); | ||
358 | editor.append_field(&field); | ||
359 | eprintln!("{}", editor.ast().syntax()); | ||
360 | } | ||
361 | } | ||