diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-06-09 12:55:24 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2024-06-09 12:55:24 +0200 |
| commit | 33b5b66a53fef0ea3fd9ccec4841290050cd95f4 (patch) | |
| tree | 3e656887b76fed9b1cc1b59bf0addd04f7596f74 /src/testing/testing.odin | |
| parent | ada14e0c911a11129daafbd486386e761661f40b (diff) | |
Improve reference testing
Diffstat (limited to 'src/testing/testing.odin')
| -rw-r--r-- | src/testing/testing.odin | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/testing/testing.odin b/src/testing/testing.odin index 2a08b23..210db59 100644 --- a/src/testing/testing.odin +++ b/src/testing/testing.odin @@ -384,42 +384,33 @@ expect_definition_locations :: proc( } } -expect_symbol_location :: proc( +expect_reference_locations :: proc( t: ^testing.T, src: ^Source, - flag: server.ResolveReferenceFlag, expect_locations: []common.Location, ) { setup(src) defer teardown(src) - symbol_and_nodes := server.resolve_entire_file( - src.document, - flag, - context.temp_allocator, - ) - - ok := true + locations, ok := server.get_references(src.document, src.position) - for location in expect_locations { + for expect_location in expect_locations { match := false - for k, v in symbol_and_nodes { - if v.symbol.range == location.range { + for location in locations { + if location.range == expect_location.range { match = true } } if !match { ok = false - log.errorf("Failed to match with location: %v", location) + log.errorf("Failed to match with location: %v", expect_location) } } if !ok { log.error("Received:") - for k, v in symbol_and_nodes { - log.errorf("%v \n", v.symbol) + for location in locations { + log.errorf("%v \n", location) } } - - } |