From a07efabcc54bea23707c4fa5e558f68f90ce42fa Mon Sep 17 00:00:00 2001 From: Daniel Gavin Date: Thu, 30 Dec 2021 02:32:35 +0100 Subject: refractor with bitsets, and fix inlined struct/union/enum --- tests/completions_test.odin | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/completions_test.odin b/tests/completions_test.odin index f4e9a7e..a9c1d0e 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -1009,7 +1009,7 @@ ast_implicit_named_comp_lit_bitset :: proc(t: ^testing.T) { } `, }; - + test.expect_completion_details(t, &source, ".", {"A", "B", "C"}); } @@ -1085,6 +1085,49 @@ ast_implicit_mixed_named_and_unnamed_comp_lit_bitset :: proc(t: ^testing.T) { test.expect_completion_details(t, &source, ".", {"A", "B", "C"}); } +@(test) +ast_inlined_struct :: proc(t: ^testing.T) { + source := test.Source { + main = `package main + import "my_package" + + My_Struct :: struct { + foo: struct { + a: int, + b: int, + }, + } + + main :: proc() { + inst: My_Struct + inst.foo.* + } + `, + }; + + test.expect_completion_details(t, &source, ".", {"struct.a: int", "struct.b: int"}); +} + +@(test) +ast_inlined_union :: proc(t: ^testing.T) { + source := test.Source { + main = `package main + import "my_package" + + My_Struct :: struct { + variant: union {int, f32}, + } + + main :: proc() { + inst: My_Struct + inst.* + } + `, + }; + + test.expect_completion_details(t, &source, ".", {"My_Struct.variant: union"}); +} + /* Looks like a bug in for each on w.* -- cgit v1.2.3