aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-05-29 16:41:24 +0200
committerDanielGavin <danielgavin5@hotmail.com>2024-05-29 16:41:24 +0200
commit9cf3c6313e77b0c3d80b8ffc298b20ab2d5b633d (patch)
tree38e14e644432a8a3dd2d23634a7b65798731371d /src/testing
parent3eb6d78ea9c2b67ca2bbcd4b775c70ab0558ab29 (diff)
Work on file resolve
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing.odin38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/testing/testing.odin b/src/testing/testing.odin
index 9f67ff0..225775c 100644
--- a/src/testing/testing.odin
+++ b/src/testing/testing.odin
@@ -58,7 +58,8 @@ setup :: proc(src: ^Source) {
} else if current == '\n' {
current_line += 1
current_character = 0
- } else if src.main[current_index:current_index + 3] == "{*}" {
+ } else if len(src.main) > current_index + 3 &&
+ src.main[current_index:current_index + 3] == "{*}" {
dst_slice := transmute([]u8)src.main[current_index:]
src_slice := transmute([]u8)src.main[current_index + 3:]
copy(dst_slice, src_slice)
@@ -383,3 +384,38 @@ expect_definition_locations :: proc(
}
}
}
+
+expect_symbol_location :: proc(
+ t: ^testing.T,
+ src: ^Source,
+ expect_locations: []common.Location,
+) {
+ setup(src)
+ defer teardown(src)
+
+ symbol_and_nodes := server.resolve_entire_file(src.document, .None)
+
+ ok := true
+
+ for location in expect_locations {
+ match := false
+ for k, v in symbol_and_nodes {
+ if v.symbol.range == location.range {
+ match = true
+ }
+ }
+ if !match {
+ ok = false
+ testing.errorf(t, "Failed to match with location: %v", location)
+ }
+ }
+
+ if !ok {
+ testing.error(t, "Received:")
+ for k, v in symbol_and_nodes {
+ testing.errorf(t, "%v \n", v.symbol)
+ }
+ }
+
+
+}