aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-06-08 21:18:13 +0200
committerDanielGavin <danielgavin5@hotmail.com>2024-06-08 21:18:13 +0200
commit53f42476fc2fe3455f1e899189cb904462502e8c (patch)
tree860ea540fdeb5a46c0f83fbc08423ee53a0363a8 /tests
parent42fefebdd512958b41948abefb2d52c1b4682aff (diff)
First version of selector rename.
Diffstat (limited to 'tests')
-rw-r--r--tests/references_test.odin73
1 files changed, 72 insertions, 1 deletions
diff --git a/tests/references_test.odin b/tests/references_test.odin
index 3f8a2cc..aa2579b 100644
--- a/tests/references_test.odin
+++ b/tests/references_test.odin
@@ -21,7 +21,7 @@ reference_variables_in_function :: proc(t: ^testing.T) {
test.expect_symbol_location(
t,
&source,
- .Variable,
+ .Identifier,
{
{
range = {
@@ -44,3 +44,74 @@ reference_variables_in_function :: proc(t: ^testing.T) {
},
)
}
+
+
+@(test)
+reference_variables_in_function_parameters :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ my_function :: proc(a: int) {
+ b := a
+ c := 2 + b
+ }
+ `,
+ packages = {},
+ }
+
+ test.expect_symbol_location(
+ t,
+ &source,
+ .Identifier,
+ {
+ {
+ range = {
+ start = {line = 1, character = 22},
+ end = {line = 1, character = 23},
+ },
+ },
+ {
+ range = {
+ start = {line = 2, character = 3},
+ end = {line = 2, character = 4},
+ },
+ },
+ {
+ range = {
+ start = {line = 3, character = 3},
+ end = {line = 3, character = 4},
+ },
+ },
+ },
+ )
+}
+
+@(test)
+reference_selectors_in_function :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ My_Struct :: struct {
+ a: int,
+ }
+
+ my_function :: proc() {
+ my: My_Struct
+ my.a = 2
+ }
+ `,
+ packages = {},
+ }
+
+ test.expect_symbol_location(
+ t,
+ &source,
+ .Field,
+ {
+ {
+ range = {
+ start = {line = 2, character = 3},
+ end = {line = 2, character = 4},
+ },
+ },
+ },
+ )
+}