aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/definition_test.odin54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/definition_test.odin b/tests/definition_test.odin
index ced4256..8718f3a 100644
--- a/tests/definition_test.odin
+++ b/tests/definition_test.odin
@@ -392,3 +392,57 @@ ast_goto_implicit_enum_infer_from_assignment_within_switch :: proc(t: ^testing.T
test.expect_definition_locations(t, &source, {location})
}
+
+@(test)
+ast_goto_variable_declaration_with_selector_expr :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+
+ Bar :: struct {
+ foo: int,
+ }
+
+ main :: proc() {
+ bar: [1]Bar
+ b{*}ar[0].foo = 5
+ }
+ `,
+ packages = {},
+ }
+
+ location := common.Location {
+ range = {
+ start = {line = 7, character = 3},
+ end = {line = 7, character = 6},
+ },
+ }
+
+ test.expect_definition_locations(t, &source, {location})
+}
+
+@(test)
+ast_goto_variable_field_definition_with_selector_expr :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+
+ Bar :: struct {
+ foo: int,
+ }
+
+ main :: proc() {
+ bar: [1]Bar
+ bar[0].fo{*}o = 5
+ }
+ `,
+ packages = {},
+ }
+
+ location := common.Location {
+ range = {
+ start = {line = 3, character = 3},
+ end = {line = 3, character = 6},
+ },
+ }
+
+ test.expect_definition_locations(t, &source, {location})
+}