aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-19 20:10:50 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-22 18:48:36 -0400
commitdc8fdcb3d55d613dc71044e7a549b15b00e12cc7 (patch)
tree952fa71105631f61758072c96a03873d578403ba /tests
parentddd6485f6ea68e445ee893721b2696aa2ab91bc4 (diff)
Add proc attribute to hover information
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin6
-rw-r--r--tests/hover_test.odin24
-rw-r--r--tests/objc_test.odin14
-rw-r--r--tests/signatures_test.odin2
4 files changed, 35 insertions, 11 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index a138849..a7df752 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -3391,9 +3391,9 @@ ast_completion_vtable_using :: proc(t: ^testing.T) {
&source,
"->",
{
- `IUnknown.QueryInterface: proc(This: ^IUnknown, riid: REFIID, ppvObject: ^rawptr) -> HRESULT`,
- `IUnknown.AddRef: proc(This: ^IUnknown) -> ULONG`,
- `IUnknown.Release: proc(This: ^IUnknown) -> ULONG`,
+ `IUnknown.QueryInterface: proc "system" (This: ^IUnknown, riid: REFIID, ppvObject: ^rawptr) -> HRESULT`,
+ `IUnknown.AddRef: proc "system" (This: ^IUnknown) -> ULONG`,
+ `IUnknown.Release: proc "system" (This: ^IUnknown) -> ULONG`,
},
)
}
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 4f81238..6c49bcf 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -2813,6 +2813,30 @@ ast_hover_proc_directives :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.foo: proc(a: int) #no_bounds_check")
}
+
+@(test)
+ast_hover_proc_attributes :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ @(require_results) f{*}oo :: proc(a: int) -> int {
+ return 0
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "@(require_results)\ntest.foo: proc(a: int) -> int")
+}
+
+@(test)
+ast_hover_proc_attributes_key_value :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ @(disabled=false) f{*}oo :: proc(a: int) -> int {
+ return 0
+ }
+ `,
+ }
+ test.expect_hover(t, &source, "@(disabled=false)\ntest.foo: proc(a: int) -> int")
+}
/*
Waiting for odin fix
diff --git a/tests/objc_test.odin b/tests/objc_test.odin
index 9d41377..412dc12 100644
--- a/tests/objc_test.odin
+++ b/tests/objc_test.odin
@@ -14,7 +14,7 @@ objc_return_type_with_selector_expression :: proc(t: ^testing.T) {
&packages,
test.Package {
pkg = "my_package",
- source = `package my_package
+ source = `package my_package
@(objc_class="NSWindow")
Window :: struct { dummy: int}
@@ -43,7 +43,7 @@ objc_return_type_with_selector_expression :: proc(t: ^testing.T) {
t,
&source,
"->",
- {"Window.initWithContentRect: my_package.Window_initWithContentRect :: proc(self: ^Window, contentRect: Rect, styleMask: WindowStyleMask, backing: BackingStoreType, doDefer: BOOL) -> ^Window"},
+ {"@(objc_type=Window, objc_name=\"initWithContentRect\")\nWindow.initWithContentRect: my_package.Window_initWithContentRect :: proc(self: ^Window, contentRect: Rect, styleMask: WindowStyleMask, backing: BackingStoreType, doDefer: BOOL) -> ^Window"},
)
}
@@ -55,7 +55,7 @@ objc_return_type_with_selector_expression_2 :: proc(t: ^testing.T) {
&packages,
test.Package {
pkg = "my_package",
- source = `package my_package
+ source = `package my_package
@(objc_class="NSWindow")
Window :: struct { dummy: int}
@@ -91,7 +91,7 @@ objc_return_type_with_selector_expression_2 :: proc(t: ^testing.T) {
t,
&source,
"->",
- {"Window.initWithContentRect: my_package.Window_initWithContentRect :: proc(self: ^Window, contentRect: Rect, styleMask: WindowStyleMask, backing: BackingStoreType, doDefer: BOOL) -> ^Window"},
+ {"@(objc_type=Window, objc_name=\"initWithContentRect\")\nWindow.initWithContentRect: my_package.Window_initWithContentRect :: proc(self: ^Window, contentRect: Rect, styleMask: WindowStyleMask, backing: BackingStoreType, doDefer: BOOL) -> ^Window"},
)
}
@@ -104,7 +104,7 @@ objc_hover_chained_selector :: proc(t: ^testing.T) {
&packages,
test.Package {
pkg = "my_package",
- source = `package my_package
+ source = `package my_package
@(objc_class="NSWindow")
Window :: struct { dummy: int}
@@ -141,7 +141,7 @@ objc_hover_chained_selector :: proc(t: ^testing.T) {
test.expect_hover(
t,
&source,
- "Window.initWithContentRect: my_package.Window_initWithContentRect :: proc(self: ^Window, contentRect: Rect, styleMask: WindowStyleMask, backing: BackingStoreType, doDefer: BOOL) -> ^Window",
+ "@(objc_type=Window, objc_name=\"initWithContentRect\")\nWindow.initWithContentRect: my_package.Window_initWithContentRect :: proc(self: ^Window, contentRect: Rect, styleMask: WindowStyleMask, backing: BackingStoreType, doDefer: BOOL) -> ^Window",
)
}
@@ -153,7 +153,7 @@ objc_implicit_enum_completion :: proc(t: ^testing.T) {
&packages,
test.Package {
pkg = "my_package",
- source = `package my_package
+ source = `package my_package
My_Enum :: enum {
Regular = 0,
Accessory = 1,
diff --git a/tests/signatures_test.odin b/tests/signatures_test.odin
index 32e5e17..4362d32 100644
--- a/tests/signatures_test.odin
+++ b/tests/signatures_test.odin
@@ -401,7 +401,7 @@ ast_index_builtin_len_proc :: proc(t: ^testing.T) {
test.expect_signature_labels(
t,
&source,
- {"$builtin.len: proc(array: Array_Type) -> int"},
+ {"@(builtin)\n$builtin.len: proc(array: Array_Type) -> int"},
)
}