Skip to content

Commit 90fe534

Browse files
committed
Split on enter tests
1 parent 52da9e9 commit 90fe534

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

crates/ra_ide/src/typing/on_enter.rs

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ mod tests {
100100
}
101101

102102
#[test]
103-
fn test_on_enter() {
103+
fn continues_doc_comment() {
104104
do_check(
105105
r"
106106
/// Some docs<|>
@@ -114,6 +114,7 @@ fn foo() {
114114
}
115115
",
116116
);
117+
117118
do_check(
118119
r"
119120
impl S {
@@ -129,34 +130,48 @@ impl S {
129130
}
130131
",
131132
);
133+
132134
do_check(
133135
r"
134-
fn main() {
135-
// Fix<|> me
136-
let x = 1 + 1;
136+
///<|> Some docs
137+
fn foo() {
137138
}
138139
",
139140
r"
140-
fn main() {
141-
// Fix
142-
// <|> me
143-
let x = 1 + 1;
141+
///
142+
/// <|> Some docs
143+
fn foo() {
144144
}
145145
",
146146
);
147+
}
148+
149+
#[test]
150+
fn does_not_continue_before_doc_comment() {
151+
do_check_noop(r"<|>//! docz");
152+
}
153+
154+
#[test]
155+
fn continues_code_comment_in_the_middle() {
147156
do_check(
148157
r"
149-
///<|> Some docs
150-
fn foo() {
158+
fn main() {
159+
// Fix<|> me
160+
let x = 1 + 1;
151161
}
152162
",
153163
r"
154-
///
155-
/// <|> Some docs
156-
fn foo() {
164+
fn main() {
165+
// Fix
166+
// <|> me
167+
let x = 1 + 1;
157168
}
158169
",
159170
);
171+
}
172+
173+
#[test]
174+
fn does_not_continue_end_of_code_comment() {
160175
do_check_noop(
161176
r"
162177
fn main() {
@@ -165,7 +180,5 @@ fn main() {
165180
}
166181
",
167182
);
168-
169-
do_check_noop(r"<|>//! docz");
170183
}
171184
}

0 commit comments

Comments
 (0)