aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-07 21:04:19 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-08-11 16:34:19 -0400
commit790cf8a16315d65bd80478aecfb34d7ff5dae31b (patch)
treec8f7e7ad40a9724fef3438a0832cb1c5791dfbbf /tests
parent03cbe19af2b3c74519be11c4de220eb9d36fa90d (diff)
Remove type information from the signature and write nested struct fields correctly
Diffstat (limited to 'tests')
-rw-r--r--tests/hover_test.odin65
1 files changed, 59 insertions, 6 deletions
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 46bd45c..f3c0af7 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -3709,11 +3709,7 @@ ast_hover_binary_expr_not_eq :: proc(t: ^testing.T) {
}
`,
}
- test.expect_hover(
- t,
- &source,
- "test.foo: bool"
- )
+ test.expect_hover(t, &source, "test.foo: bool")
}
@(test)
@@ -3728,10 +3724,67 @@ ast_hover_bit_set_in :: proc(t: ^testing.T) {
}
`,
}
+ test.expect_hover(t, &source, "test.foo: bool")
+}
+
+@(test)
+ast_hover_nested_struct :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Fo{*}o :: struct {
+ foo: int,
+ bar: struct {
+ i: int,
+ s: string,
+ }
+ }
+ `,
+ }
+ test.expect_hover(
+ t,
+ &source,
+ "test.Foo: struct {\n\tfoo: int,\n\tbar: struct {\n\t\ti: int,\n\t\ts: string,\n\t},\n}",
+ )
+}
+
+@(test)
+ast_hover_nested_struct_union :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Fo{*}o :: struct {
+ foo: int,
+ bar: union #no_nil {
+ int, // int comment
+ string,
+ }
+ }
+ `,
+ }
+ test.expect_hover(
+ t,
+ &source,
+ "test.Foo: struct {\n\tfoo: int,\n\tbar: union #no_nil {\n\t\tint, // int comment\n\t\tstring,\n\t},\n}"
+ )
+}
+
+@(test)
+ast_hover_nested_struct_enum :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Fo{*}o :: struct {
+ foo: int,
+ bar: enum {
+ // A doc
+ A,
+ B,
+ }
+ }
+ `,
+ }
test.expect_hover(
t,
&source,
- "test.foo: bool"
+ "test.Foo: struct {\n\tfoo: int,\n\tbar: enum {\n\t// A doc\n\t\tA,\n\t\tB,\n\t},\n}"
)
}
/*