Skip to content

Commit 5ca2f53

Browse files
committed
add test for wrapping record constructor
1 parent 1ee32ff commit 5ca2f53

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

compiler-core/src/language_server/tests/action.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9151,6 +9151,22 @@ fn op(i) {
91519151
);
91529152
}
91539153

9154+
#[test]
9155+
fn wrap_uncalled_constructor_in_anonymous_function() {
9156+
assert_code_action!(
9157+
WRAP_IN_ANONYMOUS_FUNCTION,
9158+
"pub fn main() {
9159+
Record
9160+
}
9161+
9162+
type Record {
9163+
Record(i: Int)
9164+
}
9165+
",
9166+
find_position_of("Record").to_selection()
9167+
);
9168+
}
9169+
91549170
#[test]
91559171
fn wrap_call_arg_in_anonymous_function() {
91569172
assert_code_action!(
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
source: compiler-core/src/language_server/tests/action.rs
3+
expression: "pub fn main() {\n Record\n}\n\ntype Record {\n Record(i: Int)\n}\n"
4+
---
5+
----- BEFORE ACTION
6+
pub fn main() {
7+
Record
8+
9+
}
10+
11+
type Record {
12+
Record(i: Int)
13+
}
14+
15+
16+
----- AFTER ACTION
17+
pub fn main() {
18+
fn(int) { Record(int) }
19+
}
20+
21+
type Record {
22+
Record(i: Int)
23+
}

0 commit comments

Comments
 (0)