diff options
| author | connnnal <216976529+connnnal@users.noreply.github.com> | 2025-07-06 18:50:10 +0100 |
|---|---|---|
| committer | connnnal <216976529+connnnal@users.noreply.github.com> | 2025-07-06 18:50:10 +0100 |
| commit | 554a69fe3887b16b31bf9dc6ceedf94ef6ec4db7 (patch) | |
| tree | d6b77e8f26dd6392079077f7d7f75ae434520782 /tests | |
| parent | cdc62a3c9d2a6b6eabf6d18e7c5077b6c861b7c4 (diff) | |
Using-by-ptr tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/completions_test.odin | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin index 7312217..2f6901b 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -3364,6 +3364,73 @@ ast_completion_inline_using :: proc(t: ^testing.T) { } @(test) +ast_completion_vtable_using :: proc(t: ^testing.T) { + source := test.Source { + main = `package main + + IUnknown :: struct { + using _iunknown_vtable: ^IUnknown_VTable, + } + + IUnknownVtbl :: IUnknown_VTable + IUnknown_VTable :: struct { + QueryInterface: proc "system" (This: ^IUnknown, riid: REFIID, ppvObject: ^rawptr) -> HRESULT, + AddRef: proc "system" (This: ^IUnknown) -> ULONG, + Release: proc "system" (This: ^IUnknown) -> ULONG, + } + + main :: proc() { + foo: ^IUnknown + foo->{*} + } + `, + } + + test.expect_completion_details( + t, + &source, + "->", + { + `IUnknown.QueryInterface: proc(This: ^IUnknown, riid: REFIID, ppvObject: ^rawptr) -> HRESULT`, + `IUnknown.AddRef: proc(This: ^IUnknown) -> ULONG`, + `IUnknown.Release: proc(This: ^IUnknown) -> ULONG`, + }, + ) +} + +@(test) +ast_complete_ptr_using :: proc(t: ^testing.T) { + source := test.Source { + main = `package main + + B :: struct { + foo: int, + } + + A :: struct { + using b: ^B, + using a: ^struct { + f: int, + }, + } + + main :: proc() { + a: A + a.foo = 2 + } + + main :: proc() { + foo: A + foo.{*} + } + `, + } + + test.expect_completion_details(t, &source, "", {`A.b: ^test.B`, `A.a: ^test.struct`, `A.foo: int`, `A.f: int`}) + +} + +@(test) ast_completion_poly_struct_another_package :: proc(t: ^testing.T) { packages := make([dynamic]test.Package, context.temp_allocator) |