Skip to content

Commit 3148696

Browse files
fruno-bulaxlpil
authored andcommitted
test: Add test for rename variable as shorthand label
1 parent 8311d4e commit 3148696

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,24 @@ pub fn main() {
325325
);
326326
}
327327

328+
#[test]
329+
fn rename_local_variable_from_label_shorthand() {
330+
assert_rename!(
331+
"
332+
type Wibble {
333+
Wibble(wibble: Int)
334+
}
335+
336+
pub fn main() {
337+
let wibble = todo
338+
Wibble(wibble:)
339+
}
340+
",
341+
"wobble",
342+
find_position_of("wibble:)")
343+
);
344+
}
345+
328346
#[test]
329347
fn rename_local_variable_in_bit_array_pattern() {
330348
assert_rename!(
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
source: compiler-core/src/language_server/tests/rename.rs
3+
expression: "\ntype Wibble {\n Wibble(wibble: Int)\n}\n\npub fn main() {\n let wibble = todo\n Wibble(wibble:)\n}\n"
4+
---
5+
----- BEFORE RENAME
6+
-- app.gleam
7+
8+
type Wibble {
9+
Wibble(wibble: Int)
10+
}
11+
12+
pub fn main() {
13+
let wibble = todo
14+
Wibble(wibble:)
15+
↑▔▔▔▔▔
16+
}
17+
18+
19+
----- AFTER RENAME
20+
-- app.gleam
21+
22+
type Wibble {
23+
Wibble(wibble: Int)
24+
}
25+
26+
pub fn main() {
27+
let wobble = todo
28+
Wibble(wibble: wobble)
29+
}

0 commit comments

Comments
 (0)