aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/completions_test.odin67
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)