Skip to content

Commit 6e01d2c

Browse files
committed
add test for wrapping record constructor
1 parent 5e926a4 commit 6e01d2c

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
@@ -9815,6 +9815,22 @@ fn op(i) {
98159815
);
98169816
}
98179817

9818+
#[test]
9819+
fn wrap_uncalled_constructor_in_anonymous_function() {
9820+
assert_code_action!(
9821+
WRAP_IN_ANONYMOUS_FUNCTION,
9822+
"pub fn main() {
9823+
Record
9824+
}
9825+
9826+
type Record {
9827+
Record(i: Int)
9828+
}
9829+
",
9830+
find_position_of("Record").to_selection()
9831+
);
9832+
}
9833+
98189834
#[test]
98199835
fn wrap_call_arg_in_anonymous_function() {
98209836
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)