diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-03-12 00:27:26 +0100 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2024-03-12 00:27:26 +0100 |
| commit | 207fe98a46b28297755608904dbf08d06fc50970 (patch) | |
| tree | ad50171aa05b2a7275243d722ec991c2afdd2278 /tests | |
| parent | 447284f2366d8cf51ab4417427cdb3c079670282 (diff) | |
Support completion and gotos for comp literals in procs
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/completions_test.odin | 25 | ||||
| -rw-r--r-- | tests/definition_test.odin | 30 |
2 files changed, 55 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin index 0330137..962e944 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -2607,3 +2607,28 @@ ast_poly_proc_matrix_whole :: proc(t: ^testing.T) { ) } + + +ast_completion_comp_lit_in_proc :: proc(t: ^testing.T) { + packages := make([dynamic]test.Package) + + source := test.Source { + main = `package test + My_Struct :: struct { + one: int, + two: int, + } + + my_function :: proc(my_struct: My_Struct) { + + } + + main :: proc() { + my_function({on{*}}) + } + `, + packages = {}, + } + + test.expect_completion_details(t, &source, "", {"My_Struct.one: int"}) +} diff --git a/tests/definition_test.odin b/tests/definition_test.odin index 6f4b982..bf9fcd7 100644 --- a/tests/definition_test.odin +++ b/tests/definition_test.odin @@ -59,3 +59,33 @@ ast_goto_comp_lit_field_indexed :: proc(t: ^testing.T) { test.expect_definition_locations(t, &source, {location}) } + +@(test) +ast_goto_untyped_comp_lit_in_proc :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + My_Struct :: struct { + one: int, + two: int, + } + + my_function :: proc(my_struct: My_Struct) { + + } + + main :: proc() { + my_function({on{*}e = 2, two = 3}) + } + `, + packages = {}, + } + + location := common.Location { + range = { + start = {line = 2, character = 4}, + end = {line = 2, character = 7}, + }, + } + + test.expect_definition_locations(t, &source, {location}) +} |