aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/hover_test.odin62
1 files changed, 58 insertions, 4 deletions
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 2a0059d..0c9aa76 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -511,7 +511,7 @@ ast_hover_foreign_package_name_collision :: proc(t: ^testing.T) {
packages = packages[:],
}
- test.expect_hover(t, &source, "node.bar: ^my_package.bar :: struct {}")
+ test.expect_hover(t, &source, "node.bar: ^my_package.bar")
}
@(test)
ast_hover_struct :: proc(t: ^testing.T) {
@@ -680,7 +680,7 @@ ast_hover_struct_field_complex_definition :: proc(t: ^testing.T) {
`,
}
- test.expect_hover(t, &source, "Foo.bar: ^test.Bar // inline docs")
+ test.expect_hover(t, &source, "Foo.bar: ^test.Bar // inline docs\n Docs")
}
@(test)
@@ -971,7 +971,7 @@ ast_hover_distinguish_names_correctly_variable_assignment :: proc(t: ^testing.T)
`,
}
- test.expect_hover(t, &source, "Foo.bar: ^test.Bar :: struct {\n\tbar: int,\n}")
+ test.expect_hover(t, &source, "Foo.bar: ^test.Bar")
}
@(test)
@@ -1007,7 +1007,7 @@ ast_hover_struct_field_use :: proc(t: ^testing.T) {
`,
}
- test.expect_hover(t, &source, "Bar.foo: test.Foo :: struct {\n\tvalue: int,\n}")
+ test.expect_hover(t, &source, "Bar.foo: test.Foo")
}
@(test)
@@ -2327,6 +2327,60 @@ ast_hover_overload_proc_strings_from_different_packages :: proc(t: ^testing.T) {
"my_package.foo: proc(a: string, b: int)",
)
}
+
+@(test)
+ast_hover_struct_field_should_show_docs_and_comments :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+
+ Foo :: struct {
+ // a docs
+ a: int, // a comment
+ }
+
+ main :: proc() {
+ foo := Foo{}
+ foo.a{*}
+ }
+ `,
+ }
+ test.expect_hover( t, &source, "Foo.a: int // a comment\n a docs")
+}
+
+@(test)
+ast_hover_struct_field_should_show_docs_and_comments_on_field :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+
+ Foo :: struct {
+ // a docs
+ a{*}: int, // a comment
+ }
+ `,
+ }
+ test.expect_hover( t, &source, "Foo.a: int // a comment\n a docs")
+}
+
+@(test)
+ast_hover_struct_field_should_show_docs_and_comments_on_struct_types :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+
+ Foo :: struct {
+ // bar docs
+ bar: Bar, // bar comment
+ }
+
+ Bar :: struct {}
+
+ main :: proc() {
+ foo := Foo{}
+ foo.bar{*}
+ }
+ `,
+ }
+ test.expect_hover( t, &source, "Foo.bar: test.Bar // bar comment\n bar docs")
+}
/*
Waiting for odin fix