aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-24 15:47:21 -0400
committerGitHub <noreply@github.com>2025-09-24 15:47:21 -0400
commita530e1c8eec638adf78f1c77720fbc07bdd31de5 (patch)
tree30e42a80052a954f351780c16129195363d4fa22 /tests
parent495012ffe93385f399d3947952466448c692f0d4 (diff)
parentd13384a1e9a0758e4c608f4dfe3226e78fa4803e (diff)
Merge pull request #1050 from BradLewis/feat/goto-def-packages
Goto definition on package use goes to package declaration
Diffstat (limited to 'tests')
-rw-r--r--tests/definition_test.odin48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/definition_test.odin b/tests/definition_test.odin
index 6e7c7a4..4810361 100644
--- a/tests/definition_test.odin
+++ b/tests/definition_test.odin
@@ -675,3 +675,51 @@ ast_goto_nested_using_struct_field :: proc(t: ^testing.T) {
test.expect_definition_locations(t, &source, locations[:])
}
+
+@(test)
+ast_goto_package_declaration :: proc(t: ^testing.T) {
+ packages := make([dynamic]test.Package, context.temp_allocator)
+
+ append(&packages, test.Package{pkg = "my_package", source = `package my_package
+ Bar :: struct{}
+ `})
+ source := test.Source {
+ main = `package test
+ import "my_package"
+
+ main :: proc() {
+ bar: m{*}y_package.Bar
+ }
+ `,
+ packages = packages[:],
+ }
+ locations := []common.Location {
+ {range = {start = {line = 1, character = 9}, end = {line = 1, character = 21}}},
+ }
+
+ test.expect_definition_locations(t, &source, locations[:])
+}
+
+@(test)
+ast_goto_package_declaration_with_alias :: proc(t: ^testing.T) {
+ packages := make([dynamic]test.Package, context.temp_allocator)
+
+ append(&packages, test.Package{pkg = "my_package", source = `package my_package
+ Bar :: struct{}
+ `})
+ source := test.Source {
+ main = `package test
+ import mp "my_package"
+
+ main :: proc() {
+ bar: m{*}p.Bar
+ }
+ `,
+ packages = packages[:],
+ }
+ locations := []common.Location {
+ {range = {start = {line = 1, character = 9}, end = {line = 1, character = 11}}},
+ }
+
+ test.expect_definition_locations(t, &source, locations[:])
+}