diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-06-08 21:18:13 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2024-06-08 21:18:13 +0200 |
| commit | 53f42476fc2fe3455f1e899189cb904462502e8c (patch) | |
| tree | 860ea540fdeb5a46c0f83fbc08423ee53a0363a8 /tests | |
| parent | 42fefebdd512958b41948abefb2d52c1b4682aff (diff) | |
First version of selector rename.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/references_test.odin | 73 |
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}, + }, + }, + }, + ) +} |