aboutsummaryrefslogtreecommitdiff
path: root/tests/hover_test.odin
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hover_test.odin')
-rw-r--r--tests/hover_test.odin62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 11ea8b3..5370804 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -4483,6 +4483,68 @@ ast_hover_float_binary_expr :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.bar: float")
}
+
+@(test)
+ast_hover_parapoly_struct_with_where_clause :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ type_is_integer :: proc($T: typeid) -> bool {
+ return true
+ }
+
+ F{*}oo :: struct($T: typeid, $N: int) #packed
+ where type_is_integer(T),
+ N > 2 {
+ x: [N]T,
+ y: [N-2]T,
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.Foo: struct($T: typeid, $N: int) #packed where type_is_integer(T), N > 2 {\n\tx: [N]T,\n\ty: [N - 2]T,\n}")
+}
+
+@(test)
+ast_hover_parapoly_proc_with_where_clause :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ fo{*}o :: proc(x: [$N]int) -> bool
+ where N > 2 #optional_ok {
+ fmt.println(#procedure, "was called with the parameter", x)
+ return true
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.foo: proc(x: [$N]int) -> bool where N > 2 #optional_ok")
+}
+
+@(test)
+ast_hover_parapoly_union_with_where_clause :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ type_is_integer :: proc($T: typeid) -> bool {
+ return true
+ }
+
+ Fo{*}o :: union($T: typeid) #no_nil where type_is_integer(T){
+ T,
+ string,
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.Foo: union($T: typeid) #no_nil where type_is_integer(T) {\n\tT,\n\tstring,\n}")
+}
+
+@(test)
+ast_hover_proc_named_return_parens :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ f{*}oo :: proc() -> (a: int) {
+ return
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "test.foo: proc() -> (a: int)")
+}
/*
Waiting for odin fix