aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-19 08:50:13 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-21 08:55:43 -0400
commit93401ea027155fd72ec7850bd0ed74ab9e2b8b07 (patch)
treeb52fbac24e4851b5754fea91811f4dfb24b2e101 /tests
parent035a0db206ae1651b8e853b5aff5c1562fc7715e (diff)
Improve hover information for constant proc lits
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin4
-rw-r--r--tests/hover_test.odin44
2 files changed, 42 insertions, 6 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index 13196a3..a97ff0f 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -4681,7 +4681,7 @@ ast_completion_struct_field_name :: proc(t: ^testing.T) {
}
`,
}
- test.expect_completion_docs(t, &source, "", {}, {"test.Foo :: struct {}"})
+ test.expect_completion_docs(t, &source, "", {}, {"test.Foo :: struct{}"})
}
@(test)
@@ -4696,7 +4696,7 @@ ast_completion_struct_field_value :: proc(t: ^testing.T) {
}
`,
}
- test.expect_completion_docs(t, &source, "", {"test.Foo :: struct {}"})
+ test.expect_completion_docs(t, &source, "", {"test.Foo :: struct{}"})
}
@(test)
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index ee43c50..9f41c2c 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -237,7 +237,7 @@ ast_hover_on_array_infer_length_variable :: proc(t: ^testing.T) {
`,
}
- test.expect_hover(t, &source, "test.vec :: [?]f32")
+ test.expect_hover(t, &source, "test.vec :: [?]f32 {\n\t1,\n\t2,\n\t3,\n}")
}
@(test)
@@ -3192,7 +3192,7 @@ ast_hover_documentation_reexported :: proc(t: ^testing.T) {
`,
packages = packages[:],
}
- test.expect_hover(t, &source, "my_package.Foo :: struct {}\n Documentation for Foo")
+ test.expect_hover(t, &source, "my_package.Foo :: struct{}\n Documentation for Foo")
}
@(test)
@@ -3218,7 +3218,7 @@ ast_hover_override_documentation_reexported :: proc(t: ^testing.T) {
`,
packages = packages[:],
}
- test.expect_hover(t, &source, "my_package.Foo :: struct {}\n New docs for Foo")
+ test.expect_hover(t, &source, "my_package.Foo :: struct{}\n New docs for Foo")
}
@(test)
@@ -3913,7 +3913,7 @@ ast_hover_map_empty_struct_literal :: proc(t: ^testing.T) {
m{*}: map[int]struct{}
`,
}
- test.expect_hover(t, &source, "test.m: map[int]struct {}")
+ test.expect_hover(t, &source, "test.m: map[int]struct{}")
}
@(test)
@@ -4878,6 +4878,42 @@ ast_hover_const_untyped_value :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.FOO :: 123")
}
+
+@(test)
+ast_hover_const_comp_lit :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: struct {
+ a: int,
+ b: string,
+ }
+
+ F{*}OO :: Foo {
+ a = 1,
+ b = "b",
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.FOO :: Foo {\n\ta = 1,\n\tb = \"b\",\n}")
+}
+
+@(test)
+ast_hover_const_comp_lit_with_type :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: struct {
+ a: int,
+ b: string,
+ }
+
+ F{*}OO : Foo : {
+ a = 1,
+ b = "b",
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.FOO : Foo : {\n\ta = 1,\n\tb = \"b\",\n}")
+}
/*
Waiting for odin fix