diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-05-11 23:39:53 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2024-05-11 23:39:53 +0200 |
| commit | 30625d5568c085c622deece91ed8ac9e81ba28be (patch) | |
| tree | 84eb3f3e4c9b38724f10b18303aa46596af4329a /tests | |
| parent | 1d2df42baa781a4838393b533601af35f9e30246 (diff) | |
Refractor ast_context.current_package now being called through defered functions
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/completions_test.odin | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin index fc0cc5c..4084c16 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -2766,3 +2766,56 @@ ast_generics_function_with_struct_diff_pkg :: proc(t: ^testing.T) { }, ) } + + +@(test) +ast_generics_function_with_comp_lit_struct :: proc(t: ^testing.T) { + packages := make([dynamic]test.Package) + + append( + &packages, + test.Package { + pkg = "my_package", + source = `package my_package + DummyFunction :: proc($T: typeid, value: T) -> T + { + return value; + } + + OtherStruct :: struct + { + val1, val2, val3: int, + } + `, + }, + ) + + source := test.Source { + main = `package main + import "my_package" + + CoolStruct :: struct + { + val1, val2, val3: int, + } + + main :: proc() + { + newValue := my_package.DummyFunction(CoolStruct, CoolStruct{}) + newValue.{*} + } + `, + packages = packages[:], + } + + test.expect_completion_details( + t, + &source, + ".", + { + "CoolStruct.val1: int", + "CoolStruct.val2: int", + "CoolStruct.val3: int", + }, + ) +} |