aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2021-12-30 02:32:35 +0100
committerDaniel Gavin <danielgavin5@hotmail.com>2021-12-30 02:32:35 +0100
commita07efabcc54bea23707c4fa5e558f68f90ce42fa (patch)
tree29ab3107245bf1a43b3881887db070817db825aa /tests
parent3ac23cfce721a19ad939750c2202685edc44d62c (diff)
refractor with bitsets, and fix inlined struct/union/enum
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin45
1 files changed, 44 insertions, 1 deletions
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.*