Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/syntax_editor.rs')
-rw-r--r--crates/syntax/src/syntax_editor.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/syntax/src/syntax_editor.rs b/crates/syntax/src/syntax_editor.rs
index a0ead400cd..5683d891be 100644
--- a/crates/syntax/src/syntax_editor.rs
+++ b/crates/syntax/src/syntax_editor.rs
@@ -655,6 +655,24 @@ mod tests {
}
#[test]
+ fn test_more_times_replace_node_to_mutable_token() {
+ let arg_list =
+ make::arg_list([make::expr_literal("1").into(), make::expr_literal("2").into()]);
+
+ let mut editor = SyntaxEditor::new(arg_list.syntax().clone());
+ let target_expr = make::token(parser::SyntaxKind::UNDERSCORE);
+
+ for arg in arg_list.args() {
+ editor.replace(arg.syntax(), &target_expr);
+ }
+
+ let edit = editor.finish();
+
+ let expect = expect![["(_, _)"]];
+ expect.assert_eq(&edit.new_root.to_string());
+ }
+
+ #[test]
fn test_more_times_replace_node_to_mutable() {
let arg_list =
make::arg_list([make::expr_literal("1").into(), make::expr_literal("2").into()]);